我正在编译错误,同时在角度2中进行反应验证
错误TS7017:对象类型的索引签名隐式具有"任何"类型
对于
this.comErrors[field] = '';
const messages = this.validationMessages[field];
this.comErrors[field] += messages[key] + ' ';
Run Code Online (Sandbox Code Playgroud)
它正在运行,但是当我试图运行npm运行build.prod时,会发生错误并且不会构建我的项目
这是我的代码:
onValueChanged(data ?: any): void {
if (!this.companyAddForm) { return; }
const form = this.companyAddForm;
for (const field in this.comErrors) {
// clear previous error message (if any)
//errors occurs
this.comErrors[field] = '';
const control = form.get(field);
if (control && control.dirty && !control.valid) {
const messages = this.validationMessages[field];
for (const key in control.errors) {
this.comErrors[field] += messages[key] + ' ';
}
}
} …Run Code Online (Sandbox Code Playgroud) 假设您有以下代码
class A {
int i = 4;
A() {
print();
}
void print () {
System.out.println("A");
}
}
class B extends A {
int i = 2; //"this line"
public static void main(String[] args){
A a = new B();
a.print();
}
void print () {
System.out.println(i);
}
}
Run Code Online (Sandbox Code Playgroud)
这将打印0 2
现在,如果删除标有"此行"的行,代码将打印4 4
A a = new B();将调用类A,将i初始化为4,调用构造函数,
将控制权交给print()方法class B,最后打印4.
a.print()将调用print()类B中的方法,因为这些方法将在运行时绑定,这也将使用在类A,4中定义的值.
(当然,如果我的推理有任何错误,请告诉我)
为什么如果你插入代码,第一部分(创建对象)将突然打印0而不是4?为什么不将变量初始化为i …
我从spring neo4j得到了不需要的查询日志,如下所示
25-08-2018 23:47:07.597 [restartedMain] INFO o.n.o.d.bolt.request.BoltRequest.executeRequest -
Request: MATCH (n:`OntoCategory`) WHERE n.`name` = { `name_0` } WITH n RETURN n,[ [ (n)-[r_h1:`HasSynonym`]->(o1:`OntoSynonyms`) | [ r_h1, o1 ] ] ], ID(n) with params {name_0=Breakfast Items}
25-08-2018 23:47:07.610 [restartedMain] INFO o.n.o.d.bolt.request.BoltRequest.executeRequest -
Run Code Online (Sandbox Code Playgroud)
我在application.properties中使用以下日志记录属性
有什么我错过了补充.我正在使用spring boot版本2.0.3
logging.level.root=info
logging.path=path
logging.file=${logging.path}/log.log
logging.pattern.file=%d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M - %msg%n
logging.pattern.console=%d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M - %n%highlight%msg%n
Run Code Online (Sandbox Code Playgroud)
以下两个日志属性从以下帖子添加,不会改变任何内容
log4j.category.org.springframework.data.neo4j=DEBUG
log4j.category.org.springframework.data.neo4j.support.query=DEBUG`
Run Code Online (Sandbox Code Playgroud) 我是 android 新手,想要填充以 id 为值和以字符串为标题的列表视图项。我能找到的所有搜索是他们建议使用字符串数组,如:
<string-array name="test">
<item>first item</item>
<item>second item</item>
</string-array>
Run Code Online (Sandbox Code Playgroud)
我正在寻找的是这样的:
<string-array name="test">
<item value="1">first item</item>
<item value="2">second item</item>
</string-array>
Run Code Online (Sandbox Code Playgroud)
就像htmloption中 a的标签一样select
Map和Map.Entry<K,V>接口之间有什么区别(如果有的话),接口的目的是Map.Entry<K,V>什么?
我dynamic web project在EclipseIDE中看到了这两个选项.
我在Eclipse IDE中工作了一年,但仍然无法在Java Build Path和之间找到明显的区别Deployment assembly,
因为当我遇到问题的一些答案建议我jar添加到部署大会(我这样做,和它的作品)和一些建议添加的东西"Java构建路径"和它的作品.有人说重启eclipse和事情都有效.
我真的很想了解差异并学习.请帮忙.
我一直在 laravel 中至少使用一个 required_without_all 字段。这是我的规则代码
'rental_company_id' => 'required_without_all:camper_id,take_over_station_id,returnable_station_id',
'camper_id' => 'required_without_all:rental_company_id,take_over_station_id,returnable_station_id',
'take_over_station_id' => 'required_without_all:rental_company_id,camper_id,returnable_station_id',
'returnable_station_id' => 'required_without_all:rental_company_id,camper_id,take_over_station_id',
Run Code Online (Sandbox Code Playgroud)
这是我的自定义消息,它将覆盖 laravel 生成的默认消息
'rental_company_id.required_without_all' => 'The Rental Companies is required when none of Campers, Takeover stations and Returnable stations are present.',
'camper_id.required_without_all' => 'The Campers is required when none of Rental Companies, Takeover stations and Returnable stations are present.',
'take_over_station_id.required_without_all' => 'The Takeover stations is required when none of Campers, Rental Companies and Returnable stations are present.',
'returnable_station_id.required_without_all' => 'The Returnable stations is …Run Code Online (Sandbox Code Playgroud) 我正在尝试将 spring mvc 集成到现有的 spring rest 项目中。春季休息的安全性工作正常。当我尝试以最低优先级顺序为 spring mvc 实现安全性时,它仅适用于 rest api。如果我为 spring mvc 设置了高优先级,那么它将适用于 spring mvc,但对于 rest api,它将重定向到登录页面。
这是我的代码片段
//base class for spring security config
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class WebSecurityConfig
Run Code Online (Sandbox Code Playgroud)
我有两个静态类
用于弹簧 mvc
@Configuration
@EnableWebSecurity
@Order(1)
public static class SecurityConfig extends WebSecurityConfigurerAdapter
Run Code Online (Sandbox Code Playgroud)
用于休息 api
@Configuration
@EnableWebSecurity
@Order(2)
public static class ApiSecurity extends WebSecurityConfigurerAdapter
Run Code Online (Sandbox Code Playgroud)
对于 spring mvc 配置
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/admin/**").hasRole("ADMIN")
.antMatchers("/resources/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/admin/login")
.defaultSuccessUrl("/admin/home",true)
.permitAll()
.and()
.logout() …Run Code Online (Sandbox Code Playgroud) 我想JSON string对两种消息使用相同的POJO 反序列化。看看下面的消息
{
"success": true,
"data": [
{
"id": 2,
"comments": null
},
{
"id": 3,
"comments": null
}
]
}
Run Code Online (Sandbox Code Playgroud)
数据是数组,但有时数据是单个对象:
{
"success": true,
"data":
{
"id": 2,
"comments": null
}
}
Run Code Online (Sandbox Code Playgroud)
我的POJO看起来像这样:
public void setData(List<Object> data)
{
this.data = data;
}
Run Code Online (Sandbox Code Playgroud)
有没有办法使用相同的类反序列化第二条消息(数据不是数组)?
亲切的问候,里卡多
我需要找到具有多个变量的等式的总可能不同解的数量.
例如:
1x + 2y + 8z = 13
Run Code Online (Sandbox Code Playgroud)
x,y和z值的不同组合总数是多少?我想不出一个算法来解决这个问题.我不需要打印答案,只需要不同组合的总数.系数和变量总是正数,也是最终数.
为什么setter在constructor处理将值分配给我的私有变量时需要一个方法。
有什么不同?
public class Account {
private String name;
public Account(String name)
{
this.name = name;
}
public void setName(String Name)
{
this.name = name;
}
public String getName()
{
return name + " is the best";
}
Run Code Online (Sandbox Code Playgroud) java ×7
algorithm ×1
android ×1
angular ×1
arrays ×1
constructor ×1
eclipse ×1
jackson ×1
javascript ×1
json ×1
laravel ×1
listview ×1
math ×1
neo4j ×1
performance ×1
php ×1
polymorphism ×1
spring ×1
spring-boot ×1
spring-data ×1
string ×1
typescript ×1
variables ×1