我在angular2应用程序中的路由效果很好.但我将基于此做一些routeLink :
这是我的路线:
const routes: RouterConfig = [
{ path:'home' , component: FormComponent },
{ path:'about', component: AboutComponent },
{ path:'**' , component: FormComponent }
];
Run Code Online (Sandbox Code Playgroud)
这是我做的链接:
<ul class="nav navbar-nav item">
<li>
<a routerLink='/home' routerLinkActive="active">Home</a>
</li>
<li>
<a routerLink='/about' routerLinkActive="active">About this</a>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我希望,当我点击它们时,它会导航到受尊重的组件,但它们不执行任何操作?
我看了类似的问题,但没有一个帮助过我.我将收到如下对象:
[
{
"id": 1,
"name": "Safa",
"email": "neerupeeru@mail.ee",
"purpose": "thesis",
"programme": "Software Engineering",
"year": 2016,
"language": "Estonian",
"comments": "In need of correcting a dangling participle.",
"status": "RECEIVED"
},
{
"id": 2,
"name": "Safa",
"email": "neerupeeru@mail.ee",
"purpose": "thesis",
"programme": "Software Engineering",
"year": 2016,
"language": "Estonian",
"comments": "In need of correcting a dangling participle.",
"status": "RECEIVED"
},
{
"id": 3,
"name": "Salman",
"email": "neerupeeru@mail.ee",
"purpose": "thesis",
"programme": "Software Engineering",
"year": 2016,
"language": "Estonian",
"comments": "In need of correcting a dangling participle.", …Run Code Online (Sandbox Code Playgroud) 对不起新手问题.
我使用SQLite数据库浏览器创建了我的表,但是:
我不知道如何使用该应用程序指定我的外键?
如何在表之间创建关系图?
在我的春季mvc应用程序中,我有以下对象.我试图devtool在我的应用程序中使用数据视觉.
@Entity
@Data
public class ConsultationRequest {
@Id
@GeneratedValue
private Long id;
private String name;
private String email;
private String purpose;
private String programme;
private int year;
private String language;
private String comments;
@Enumerated(EnumType.STRING)
private ConsultationStatus status;
}
Run Code Online (Sandbox Code Playgroud)
然后我使用jpa来制作实体:
@Repository
public interface ConsultationRequestRepository extends JpaRepository<ConsultationRequest, Long> {
}
Run Code Online (Sandbox Code Playgroud)
问题是当我加载我的应用程序时,我遇到了2个错误:
Unsuccessful: drop sequence hibernate_sequence
[36morg.hibernate.tool.hbm2ddl.SchemaExport Sequence "HIBERNATE_SEQUENCE" not found; SQL statement:
Run Code Online (Sandbox Code Playgroud)
然后,当我打开
http://localhost:8080/h2-console/
Run Code Online (Sandbox Code Playgroud)
我看不到桌子.似乎在启动过程中,表没有制作.
在我的java spring应用程序中,我正在使用hibernate和jpa,我使用jackson在DB中填充数据.
这是User类:
@Data
@Entity
public class User{
@Id
@GeneratedValue
Long id;
String username;
String password;
boolean activated;
public User(){}
}
Run Code Online (Sandbox Code Playgroud)
第二类是:
@Entity
@Data
public class Roles {
@Id
@GeneratedValue
Long id;
@OneToOne
User user;
String role;
public Roles(){}
}
Run Code Online (Sandbox Code Playgroud)
在Roles类中,我有一个User属性, 然后我创建了一个json文件来存储数据:
[ {"_class" : "com.example.domains.User", "id": 1, "username": "Admin", "password": "123Admin123","activated":true}
,
{"_class" : "com.example.domains.Roles", "id": 1,"user":1, "role": "Admin"}]
Run Code Online (Sandbox Code Playgroud)
不幸的是,当我运行应用程序时,它抱怨:
.RuntimeException: com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.example.domains.User: no int/Int-argument constructor/factory method to deserialize from Number value (1)
at …Run Code Online (Sandbox Code Playgroud) 在我的angular2应用程序中,我有服务向网址发送获取请求.
这是我的服务:
import {Http} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import {Injectable} from '@angular/core';
import {Gallery} from './gallery';
@Injectable()
export class InstagramService{
constructor(private _http:Http){
}
getGallery(username: string) : Observable<Gallery> {
var result=this._http.get("https://www.instagram.com/"+username+"/media/").map(res => res.json());
console.log(result);
return result;
}
}
Run Code Online (Sandbox Code Playgroud)
我已将返回类型定义为Observable<Gallery>,但它抱怨:
A function whose declared type is neither 'void' nor 'any' must return a value
Run Code Online (Sandbox Code Playgroud)
这段代码出了什么问题?
我知道根均方误差$sigma的概念之间存在细微差别.所以,我想知道在R中获取RMSE 功能的最简单方法是什么?lm
res<-lm(randomData$price ~randomData$carat+
randomData$cut+randomData$color+
randomData$clarity+randomData$depth+
randomData$table+randomData$x+
randomData$y+randomData$z)
length(coefficients(res))
Run Code Online (Sandbox Code Playgroud)
包含24个系数,我不能再手动制作我的模型了.那么,我如何根据系数驱动来评估RMSE lm?
鉴于此,我有一个如下的数据框:
import pandas as pd
import numpy as np
dict = {
"A": [[1,2,3,4],[3],[2,8,4],[5,8]]
}
dt = pd.DataFrame(dict)
Run Code Online (Sandbox Code Playgroud)
我希望B 列中每一行的最大值和最小值。我最喜欢的输出是:
A B
0 [1, 2, 3, 4] [1,4]
1 [3] [3,3]
2 [2, 8, 4] [2,8]
3 [5, 8] [5,8]
Run Code Online (Sandbox Code Playgroud)
我已经尝试过以下代码不起作用:
dt["B"] =[np.min(dt.A), np.max(dt.A)]
Run Code Online (Sandbox Code Playgroud) 当用户按Backspace按钮时,我正在尝试处理事件.
我看到了这个,我猜,我可以找到Backspace密钥代码
console.log( "Did u delete it? "+ e.keyCode);
但是价值e.keyCode是未定义的.
这是代码:
define(["react"], (React) => {
var TypingContainer = React.createClass({
keypressed(e){
console.log( "Did u delete it"+ e.keyCode);
},
handleChange: function(e) {
// if(e.keycode==8)
console.log( "Did u delete it? "+ e.keyCode);
},
render: function() {
return(
<div>
<input
className="typing-container"
value={this.state.message}
onChange={this.handleChange}
onKeyPress={this.keypressed}
/>
</div>
);
}
})
return TypingContainer;
});
Run Code Online (Sandbox Code Playgroud)
更新:onKeyPress事件我总是0.
在我的 Java spring 应用程序中,我有
public class BinarySearchImpl {
@Autowired
@Qualifier("Quick")
SortAlgorithem sorter;
Log log=LogFactory.getLog(BinarySearchImpl.class);
public BinarySearchImpl(SortAlgorithem sorter) {
log.info("Binary Search Bean is created");
this.sorter=sorter;
}
Run Code Online (Sandbox Code Playgroud)
SortAlgorithem 是一个接口,它使我的应用程序松散耦合:
public interface SortAlgorithem {
public int[] sort(int[] arrayNumbers);
}
Run Code Online (Sandbox Code Playgroud)
然后这个接口有2个实现。一种是BubbleSort:
@Component
@Qualifier("Bubble")
public class BubbleSort implements SortAlgorithem {
Log log=LogFactory.getLog(BubbleSort.class);
public int[] sort(int[] numbers) {
log.info("Bubble sort is called");
return numbers;
}
}
Run Code Online (Sandbox Code Playgroud)
另一个是QuickSort:
@Component
@Qualifier("Quick")
//@Primary
public class QuickSort implements SortAlgorithem{
Log log= LogFactory.getLog(QuickSort.class);
public int[] sort(int[] numbers) …Run Code Online (Sandbox Code Playgroud)