我希望在选择一个复选框时禁用其他复选框.我是这样做的
<span class="input-group-addon">
<input type="checkbox" name="ssn" (change)="checkBox[0].checked=!checkBox[0].checked">
</span>
<span class="input-group-addon">
<label>{{checkBox[0].label}}</label>
</span>
<input [(ngModel)]="ssn" type="password" name="ssnText" class="form-control" placeholder=" ">
Run Code Online (Sandbox Code Playgroud)
我有6个复选框,所有这些都像上面一样.但是我希望他们只能选择1个复选框,而不是像现在这样做.
在我的组件中:
ssn:string;
userId:string;
lastName:string;
office:string;
role:string;
checkIfOthersAreSelected:boolean
checkBox = [
{label: 'SSN', name:'ssn', checked:false},
{label: 'Last Name', name:'lastName', checked:false},
{label: 'Role', name:'role', checked:false},
{label: 'UserId', name:'userId', checked:false},
{label: 'Office', name:'office', checked:false},
{label: ' Include Subordinates', name:'subordinates', checked:false}
];
Run Code Online (Sandbox Code Playgroud)
html中的按钮
<button type="submit" (click)="search(checkBox)" class="btn btn-default btn-md left-button">Search</button>
Run Code Online (Sandbox Code Playgroud)
searchMethod
public search(checkboxArray) {
let ssn = checkboxArray[0];
let lastName=checkboxArray[1];
let role=checkboxArray[2];
let userId= …Run Code Online (Sandbox Code Playgroud) 为了推广这一问题上运行docker run zookeeper,然后docker-compose up在下面的yaml文件.
我正在使用zookeeper最新图片,wurstmeister/kafka:0.9.0.0-1和sheepkiller/kafka-manager:latest.我跑了docker-compose up,finallzy让它工作,但现在我收到以下错误:
我已经搜索了git并且无法使用堆栈.在我保存群集之前,一切看起来都很好.在Kafka日志中,我得到:
[warn] oazClientCnxn - 服务器空的会话0x0,意外错误,关闭套接字连接并尝试重新连接kafka-manager_1 | java.net.ConnectException:连接拒绝了kafka-manager_1 | at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)〜[na:1.8.0_151] kafka-manager_1 | at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)〜[na:1.8.0_151] kafka-manager_1 | 在org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)〜[org.apache.zookeeper.zookeeper-3.4.6.jar:3.4.6-1569965] kafka-manager_1 | at org.apache.zookeeper.ClientCnxn $ SendThread.run(ClientCnxn.java:1081)~ [org.apache.zookeeper.zookeeper-3.4.6.jar:3.4.6-1569965]
我也看到了这个:
INFO Got user-level KeeperException when processing sessionid:0x160fb22e9f50000 type:create cxid:0x2a zxid:0x3e txntype:-1 reqpath:n/a Error Path:/brokers/ids Error:KeeperErrorCode = NodeExists for /brokers/ids (org.apache.zookeeper.server.PrepRequestProcessor)
Run Code Online (Sandbox Code Playgroud)
这可以通过启动zookeeper并获取下面的yaml文件配置并运行来复制docker-compose up.我已经休息了一个星期,我不知道为什么它不起作用.
Yaml文件:
zookeeper:
image: confluent/zookeeper
ports:
- "2181:2181"
kafka:
image: wurstmeister/kafka:0.9.0.0-1
ports:
- "9092:9092"
links: …Run Code Online (Sandbox Code Playgroud) 我在我的VPS上部署war文件时遇到了很多问题.
我有java-8和tomcat-8.我的服务器是Apache/2.2.22(Debian),我的HTTP在端口80上,tomcat在8080上.
目前,如果您访问www.drew-jocham.com,则会列出一个空目录.但是,如果您访问www.drew-jocham.com:8080/resumesite,您将获得在tomcat上运行的页面.
当然,我要做的是让用户输入www.drew-jocham.com而不是端口等.
到目前为止,我已经设置了一个虚拟主机 nano /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
ServerAdmin drew@drew-jocham.com
ServerName www.drew-jocham.com
ServerAlias drew-jocham.com
ProxyPass /resumesite http://localhost:8080/resumesite
ProxyPassReverse /resumesite http://localhost:8080/resumesite
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
在tomcat中我的server.xml文件中我设置了一个 <Host></Host>
<Host name="www.drew-jocham.com" appbase="webapps"
unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="resumesite_log." suffix=".txt"
pattern="common"/>
</Host>
Run Code Online (Sandbox Code Playgroud)
通过上面的设置,每个域都只列出了我的VPS目录.此时我不知道该怎么办.
我的问题是:
我希望用户输入www.drew-jocham.com而不是www.drew-jocham.com:8080/resumesite.我试图这样做,但就像我上面说的,我的VPS上的每个域都只是用上面的设置列出我的服务器整个目录.
很快所有网站都将成为战争文件,因此服务器上会有多个域名.有些将直接存储在tomcat webapps中,有些则存储在端口80上的HTTP服务器上.
-------------------更新1 -------------------
我去nano /etc/apache2/sites-enabled/000-default.conf添加以下内容并重新启动我的tomcat服务器.
<VirtualHost *:80>
ServerAdmin drew@drew-jocham.com
ServerName www.drew-jocham.com
ServerAlias drew-jocham.com
ProxyPass / http://localhost:8080/resumesite
ProxyPassReverse / http://localhost:8080/resumesite
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
当我去www.drew-jocham.com时,除了以下图片之外,仍然没有任何渲染:
它还将www.drew-jocham/resumesite添加到我的VPS上的每个域中,其中我有几个,从而打破了它们.
但是,如果我仍然去www.drew-jocham.com:8080/resumesite它渲染.
当我在tomcat 8中渲染这个应用程序时,我一直得到一个空白页面.我看到的唯一错误是:
o.s.boot.context.web.ErrorPageFilter: Cannot forward to error page for
request [/] as the response has already been committed.
Run Code Online (Sandbox Code Playgroud)
因此我的问题是我无法呈现index.html页面.
我拿了一个静态页面并在其中添加了一个spring-boot模块.自从我做了更改后,我再也无法呈现页面了.我有index.html文件templates
我在我的控制器中添加了注释,看看它们是否被击中而且它们不是:
@Controller
public class ApplicationController {
@Autowired
ContactService contactService;
@RequestMapping(value="/", method= RequestMethod.GET)
public String contactForm() throws IOException {
System.out.println("Inside GET in Application Controller");
//model.addAttribute("contact", new Contact());
return "index";
}
@RequestMapping(value="/contact", method= RequestMethod.POST)
public String contactSubmit() throws IOException {
System.out.println("Inside POST in Application Controller");
return "index";
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用Thymeleaf,但决定反对它,这就是为什么方法中的参数是空白的.
我已将项目上传到GIT,以便有人在需要时更容易地下载和下载.
----------------更新1 ----------------------
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter { …Run Code Online (Sandbox Code Playgroud) 我在我的IDE中得到以下错误,说明Property id does not exist on type string typeScript这行代码:
if(customer.id === id) {//doesn't like customer.id
return customer;
}
Run Code Online (Sandbox Code Playgroud)
完整代码:
let customer:any [];
function Customers(): string[] {
let id = 0;
createCustomer("Drew",id++,22,"Glassboro");
createCustomer("Mike",id++,40,"Rineyville");
createCustomer("Justin",id++,19,"Jonesboro");
createCustomer("Alex",id++,15,"Paulsboro");
createCustomer("Phil",id++,32,"Glassboro");
return customer;
}
function createCustomer(name:string,id:number,age:number,city:string){
customer.push(name,id,age,city);
}
const allCustomers = Customers();
function getCustomerInformation(id:number): string {
for (let customer of allCustomers) {
if(customer.id === id){
return customer;
}
}
return "";
}
Run Code Online (Sandbox Code Playgroud)
这是我的假设,因为我习惯了any,let customer:any [];我可以在那里放置不同的变量.
-----------------感谢您的帮助,这是我的新解决方案--------
interface ICustomer{
id: number; …Run Code Online (Sandbox Code Playgroud) 我有一些与此几乎相同的东西,它运行良好,现在出现以下错误。我有parallel,steps而且stages都在那里。
错误:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 23: Unknown stage section "sh". Starting with version 0.5, steps in a stage must be in a steps block. @ line 23, column 7.
stage('build api image') {
^
WorkflowScript: 26: Unknown stage section "sh". Starting with version 0.5, steps in a stage must be in a steps block. @ line 26, column 7.
stage('build view image') {
^
WorkflowScript: 20: No "steps" or "parallel" to execute within …Run Code Online (Sandbox Code Playgroud) 我有一个spring-boot应用程序.当我开始在我的intellij IDE中运行Tomcat 8.0_35我没有问题,看起来很棒.我决定部署在我的VPS上,只有HTML渲染.我通过手动将.war文件放入webapps,在我的localhost上复制了这个问题.由于我收到所有404错误,我想我可能需要设置一个webconfig类:
@Configuration
public class WebConfiguration extends WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter {
private static final Logger log = Logger.getLogger(WebMvcAutoConfiguration.class);
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
registry.addResourceHandler("/css/**").addResourceLocations("/resources/css/");
registry.addResourceHandler("/image/**").addResourceLocations("/resources/image/");
registry.addResourceHandler("/images/**").addResourceLocations("/resources/images/");
registry.addResourceHandler("/javascripts/**").addResourceLocations("/resources/javascripts/");
registry.addResourceHandler("/libs/**").addResourceLocations("/resources/lib/");
}
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}
@Bean
public DispatcherServlet dispatcherServlet(){
DispatcherServlet dispatcherServlet = new DispatcherServlet();
dispatcherServlet.setThrowExceptionIfNoHandlerFound(true);
return dispatcherServlet;
}
@Bean
public ServletContextTemplateResolver templateResolver() {
ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
resolver.setPrefix("/WEB-INF/");
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML5");
resolver.setOrder(1);
return resolver;
}
}
Run Code Online (Sandbox Code Playgroud)
我需要的是ServletContextTemplateResolver因为我使用的是spring-mobile而且我在渲染页面时遇到了问题.
我没有看到在Tomcat的日志或者任何localhost.log与cataline.log
@SpringBootApplication
public class StidhamFinancialApplication …Run Code Online (Sandbox Code Playgroud) 我似乎设置了可错的故障.
错误:
ReferenceError: Can't find variable: Map
at src/app/home/home.component.spec.ts:4
ReferenceError: Can't find variable: Map
at http://localhost:63247/__modules/27.js?1483285680907:80
Run Code Online (Sandbox Code Playgroud)
我这样设置我的js文件:
var wallabyWebpack = require('wallaby-webpack');
var webpackPostprocessor = wallabyWebpack({
entryPatterns: [
'src/wallabyTest.js',
'src/**/*spec.js'
],
module: {
loaders: [
{test: /\.css$/, loader: 'raw-loader'},
{test: /\.html$/, loader: 'raw-loader'},
{test: /\.js$/, loader: 'angular2-template-loader', exclude: /node_modules/},
{test: /\.json$/, loader: 'json-loader'},
{test: /\.styl$/, loaders: ['raw-loader', 'stylus-loader']},
{test: /\.less$/, loaders: ['raw-loader', 'less-loader']},
{test: /\.scss$|\.sass$/, loaders: ['raw-loader', 'sass-loader']},
{test: /\.(jpg|png)$/, loader: 'url-loader?limit=128000'}
]
}
});
var compilerOptions = require('./src/tsconfig.json').compilerOptions; …Run Code Online (Sandbox Code Playgroud) 我试图找到一个解决方案,我希望通过数据从一个oracle数据库对另一个oracle DB实现回归测试.
示例:数据库A添加一个表,我想从数据库A中获取数据并将其导入数据库模式B.这最终会失败,我会知道某种更改并且可以更正它.
我想在詹金斯自动化这个可以进行夜间测试.我找到了几个付费版本,但在项目的这一点上没有必要.
我正在使用Liquibase,但我无法找到Jenkins的插件.我知道Sql Developer可以做到这一点,但我希望这是自动化的.
如果有人有任何过去的经验或知道任何工具,我会非常感谢这些建议.
我最近制作了一个应用程序,该应用程序从一个数据库(旧版)中获取数据,然后将其放入另一个数据库中(新的开发数据库)。我发现困惑save并不总是奏效,而是奏效saveAndFlush了。该legacy数据库是在一个事务select和新的数据库是另一个deleteAll和save。
该应用程序运行非常缓慢saveAndFlush且易于理解,但save效果并不好。然后我决定使用,saveAll但是为每个表创建一个巨大列表的想法对我来说并不成立。所以我试图像这样调用车库收集:
productRepository.saveAll(productList);
productList.clear();
productList = null;
System.gc();
Run Code Online (Sandbox Code Playgroud)
然后我添加jdbc.batch_size到application.properties
logging.level.org.hibernate.SQL=info
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.jpa.generate-ddl = true
spring.jpa.properties.hibernate.jdbc.batch_size = 20
spring.jpa.properties.hibernate.order_inserts = true
spring.jpa.properties.hibernate.order_updates = true
spring.jpa.properties.hibernate.jdbc.batch_versioned_data = true
Run Code Online (Sandbox Code Playgroud)
之前需要花两个小时才能运行,现在只有5分钟-巨大的性能提升。
现在我很困惑发生了什么。我读到的是“定期更新和关闭会话”。但是delete和saveAll是一次交易-因此对我来说这没有意义。
因此要弄清楚为什么有两个问题:
1)为什么不save总是有效但saveAndFlush会起作用?
2)有50个表,每个表有20,000行,每个表创建一个列表,然后saveAll清除该列表并建议进行垃圾回收。application.properties与方法相比,将上面的内容添加到导致应用程序极快#1。为什么?冬眠在做什么?是否定期更新和清除会话?
我认为正在发生的事情是第一层缓存保留了删除和插入操作,然后提交并希望将其刷新。显然我是错误的,或者至少不是完全正确的。