我想使用Dockerizing MongoDB并将数据存储在本地卷中.
但......失败了......
它有mongo:最新的图像
kerydeMacBook-Pro:~ hu$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
mongo latest b11eedbc330f 2 weeks ago 317.4 MB
ubuntu latest 6cc0fc2a5ee3 3 weeks ago 187.9 MB
Run Code Online (Sandbox Code Playgroud)
我想将单声道数据存储在〜/ data中.所以---
kerydeMacBook-Pro:~ hu$ docker run -p 27017:27017 -v ~/data:/data/db --name mongo -d mongo
f570073fa3104a54a54f39dbbd900a7c9f74938e2e0f3f731ec8a3140a418c43
Run Code Online (Sandbox Code Playgroud)
但是......它不起作用......
docker ps - 没有守护进程mongo
kerydeMacBook-Pro:~ hu$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Run Code Online (Sandbox Code Playgroud)
尝试运行"mongo" - 失败
kerydeMacBook-Pro:~ hu$ docker exec -it f57 bash
Error response from daemon: Container f57 is …
Run Code Online (Sandbox Code Playgroud) 我使用Spring Boot并包含jackson-datatype-jsr310
在Maven中:
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.7.3</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
当我尝试使用具有Java 8日期/时间类型的RequestParam时,
@GetMapping("/test")
public Page<User> get(
@RequestParam(value = "start", required = false)
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime start) {
//...
}
Run Code Online (Sandbox Code Playgroud)
并使用以下URL测试它:
/test?start=2016-10-8T00:00
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
{
"timestamp": 1477528408379,
"status": 400,
"error": "Bad Request",
"exception": "org.springframework.web.method.annotation.MethodArgumentTypeMismatchException",
"message": "Failed to convert value of type [java.lang.String] to required type [java.time.LocalDateTime]; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@org.springframework.web.bind.annotation.RequestParam @org.springframework.format.annotation.DateTimeFormat java.time.LocalDateTime] for value '2016-10-8T00:00'; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for …
Run Code Online (Sandbox Code Playgroud) 我使用"angular2 webpack"和"angular2/form,Observable",但遇到错误,需要帮助..
有一个自定义表单验证器 -
import {Observable} from 'rxjs/Rx';
import {REACTIVE_FORM_DIRECTIVES,FormControl, FormGroup, Validators} from '@angular/forms';
emailShouldBeUnique(control:FormControl) {
return new Observable((obs:any)=> {
control.valueChanges
.debouceTime(400)
.distinctUntilChanged()
.flatMap(term=>return !this.userQuery.emailExist(term))
.subscribe(res=> {
if (!res) {obs.next(null)}
else {obs.next({'emailExist': true}); }; }
)});}
Run Code Online (Sandbox Code Playgroud)
我可以找到文件 "/projection_direction/node_modules/rxjs/operator/debounceTime.js"
为什么会有这样的错误 -
属性'debouceTime'在'Observable'类型上不存在.
我创建了一个 docker 卷“hello”,它包含一些数据。
怎么复制到本地?
第一的 :
kerydeMacBook-Pro:~ hu$ docker volume create --name hello
hello
Run Code Online (Sandbox Code Playgroud)
检查:
kerydeMacBook-Pro:~ hu$ docker volume ls
DRIVER VOLUME NAME
local hello
Run Code Online (Sandbox Code Playgroud)
卷“你好”检查
kerydeMacBook-Pro:~ hu$ docker volume inspect hello
[
{
"Name": "hello",
"Driver": "local",
"Mountpoint": "/mnt/sda1/var/lib/docker/volumes/hello/_data"
}
]
Run Code Online (Sandbox Code Playgroud)
如何将卷“hello”复制到本地?
我尝试:
kerydeMacBook-Pro:~ hu$ docker cp hello:/mnt/sda1/var/lib/docker/volumes/hello/_data /Users/hu/Desktop/12
Error response from daemon: no such id: hello
Run Code Online (Sandbox Code Playgroud)
它不像预期的那样工作!
谁能帮我 ?
我想在同一个请求中实现post文件和Json数据.
以下是上传文件代码:
upload(url:string,file:File):Observable<{complate:number,progress?:number,data?:Object}>{
return Observable.create(observer => {
const formData:FormData = new FormData(),
xhr:XMLHttpRequest = new XMLHttpRequest();
formData.append('uploadfile', file);
formData.append("_csrf", this.tokenService.getCsrf());
xhr.open('POST',url, true);
xhr.onreadystatechange = () => {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
observer.next({complate:1,progress:100,data:JSON.parse(xhr.response)});
observer.complete();
} else {
observer.error(xhr.response);
}
}
};
xhr.upload.onprogress = (event) => {
observer.next({complate:0,progress:Math.round(event.loaded / event.total * 100)});
};
const headers=new Headers();
let token: string = localStorage.getItem('access-token');
xhr.setRequestHeader('Authorization', `Bearer ${token}`);
xhr.send(formData);
}).share();
Run Code Online (Sandbox Code Playgroud)
如何与angular2 http.post(url,JSON.stringify(data))集成.
我使用@ ng-bootstrap/ng-bootstrap和Angular2-cli
与NgbDatepicker遇到了错误:
NgModule:
@NgModule({
imports: [CommonModule,NgbModule.forRoot()],
declarations: [TestComponent],
exports: [TestComponent]
})
Run Code Online (Sandbox Code Playgroud)
零件 -
导出类TestComponent实现OnInit {
model:NgbDateStruct;
}
和html--
<ngb-datepicker #dp [(ngModel)] ="model"> </ ngb-datepicker>
将TestModule添加到另一个模块时
@NgModule({
imports: [SharedModule,LoginRoutingModule,TestModule],
declarations: [LoginComponent],
})
Run Code Online (Sandbox Code Playgroud)
和HTML:
<app-test></app-test>
Run Code Online (Sandbox Code Playgroud)
有错误:
error_handler.js:47EXCEPTION: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'ngb-datepicker'.
1. If 'ngb-datepicker' is an Angular component and it has 'ngModel' input, then verify that it is part of this module.
2. …
Run Code Online (Sandbox Code Playgroud) 我研究 spring cloud eureka,cloud 并且它们工作得很好。但是在eureka服务中添加了安全性后,却遇到了一些错误。
所有代码和错误细节都在https://github.com/keryhu/eureka-security
eureka 服务 application.yml
security:
user:
name: user
password: password
eureka:
client:
registerWithEureka: false
fetchRegistry: false
server:
wait-time-in-ms-when-sync-empty: 0
Run Code Online (Sandbox Code Playgroud)
和 config-service application.java
@SpringBootApplication
@EnableConfigServer
@EnableDiscoveryClient
Run Code Online (Sandbox Code Playgroud)
配置服务应用程序.yml
eureka:
client:
registry-fetch-interval-seconds: 5
serviceUrl:
defaultZone: http://user:password@${domain.name:localhost}:8761/eureka/
spring:
cloud:
config:
server:
git:
uri: https://github.com/spring-cloud-samples/config-repo
basedir: target/config
Run Code Online (Sandbox Code Playgroud)
启动config-service后有错误导出:
2016-04-10 11:22:39.402 ERROR 80526 --- [get_localhost-3] c.n.e.cluster.ReplicationTaskProcessor : Batch update failure with HTTP status code 401; discarding 1 replication tasks
2016-04-10 11:22:39.402 WARN 80526 --- [get_localhost-3] c.n.eureka.util.batcher.TaskExecutors : Discarding 1 tasks …
Run Code Online (Sandbox Code Playgroud) spring spring-security spring-cloud netflix-eureka spring-cloud-netflix
我的操作系统是:ubuntu:15.10
我想使用官方的docker-hub redis,但是遇到了问题。
我的docker-compose.yml
version: '2'
services:
redis:
image: redis
ports:
- "6379:6379"
volumes:
- ~/dbdata/redis_conf/redis.conf:/usr/local/etc/redis/redis.conf
volumes_from:
- redisdata
environment:
- REDIS_PASSWORD: 29c4181fb842b5f24a3103dbd2ba17accb1f7e3c8f19868955401ab921
command: redis-server /usr/local/etc/redis/redis.conf
redisdata:
image: redis
volumes:
- /home/keryhu/dbdata/redisdb:/data
command: --break-redis
Run Code Online (Sandbox Code Playgroud)
我将默认的redis.conf复制到“〜/ dbdata / redis_conf / redis.conf”目录。然后只需将“ requirepass”修改为“ 29c4181fb842b5f24a3103dbd2ba17accb1f7e3c8f19868955401ab921”
当我启动容器时,我遇到了一个错误-
*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 103
>>> 'logfile /var/log/redis/redis-server.log'
Can't open the log file: No such file or directory
Run Code Online (Sandbox Code Playgroud)
可以帮我 ?
我使用ng-bootstrap Angular 2.
<nav class="navbar navbar-fixed-top navbar-dark bg-inverse">
<ul class="nav navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">About</a>
</li>
<li class="nav-item">
<div ngbDropdown>
<button class="btn" ngbDropdownToggle>Projects</button>
<div class="dropdown-menu">
<button class="dropdown-item" >AA</button>
</div>
</div>
</li>
</ul>
</nav>
Run Code Online (Sandbox Code Playgroud)
问题"下拉菜单"无法扩展
我想在webpack bootstrap 4 env中这样做:
http://v4-alpha.getbootstrap.com/components/forms/#custom-forms
文件浏览器
<label class="custom-file">
<input type="file" id="file" class="custom-file-input">
<span class="custom-file-control"></span>
</label>
Run Code Online (Sandbox Code Playgroud)
如何覆盖"占位符" 和"按钮标签"值
我使用Spring Mongo Data Rest和querydsl
域:具有属性:
@DateTimeFormat(iso = ISO.DATE_TIME)
private LocalDateTime registerTime;
Run Code Online (Sandbox Code Playgroud)
要使用Json,我添加:
杰克逊数据类型jsr310
LocalDateTime可以工作:
“ http:// localhost:8001 / api / users ”
它显示:'2016-10-26T21:08:58.91'
当我将querydsl与控制器一起使用时:
@GetMapping("/admin/queryWithPage")
public Page<User> get(
@PageableDefault(page = 0, size = 10, sort = "id", direction = Sort.Direction.DESC) Pageable pageable,
@RequestParam(value = "registerTimeBegin", required = false)
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime registerTimeBegin,
@RequestParam(value = "registerTimeEnd", required = false)
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime registerTimeEnd,
){
QUser user=new QUser("user");
Predicate registerTimePredicate=null;
boolean registerTimeNotNull=registerTimeBegin!=null&®isterTimeEnd!=null;
if(registerTimeNotNull){
registerTimePredicate=user.registerTime.
between(registerTimeBegin,registerTimeEnd);
}
return repository.findAll(registerTimePredicate,pageable);
}
Run Code Online (Sandbox Code Playgroud)
它有错误: …
我使用angular2 cli。
测试导航相对遇到的问题:
路由配置:
{
path: '',
component: CheckCompanyComponent,
children:[
{
path:'',
loadChildren: 'app/components/company/check-company-home/check-company-home.module#CheckCompanyHomeModule'
},
{
path:':id',
loadChildren: 'app/components/company/check-company-detail/check-company-detail.module#CheckCompanyDetailModule'
}
]
}
Run Code Online (Sandbox Code Playgroud)
在check-company-home组件中
goIdPage(){
this.router.navigate(['22'], { relativeTo: this.route });
}
Run Code Online (Sandbox Code Playgroud)
可以从“ / company”导航到“ / company / 22”
在check-company-detail组件中:
goBack(){
this.router.navigate(['../'], { relativeTo: this.route });
}
Run Code Online (Sandbox Code Playgroud)
但是无法将表格“ / company / 22”导航到“ / company”,
为什么?
我构建了一个 spring 云服务,包含 eureka、user-service(spring-data-rest user api) 和一个 feign-client 服务。
在假客户端:
@FeignClient("useraccount")
public interface UserFeign {
@RequestMapping(method=RequestMethod.POST,value="/users",consumes = "application/json")
void createUser(@RequestBody User user);
@RequestMapping(method=RequestMethod.DELETE,value="/users/{id}")
void delById (@PathVariable("id") String id);
Run Code Online (Sandbox Code Playgroud)
我想通过调用 user-service api 在 feign-client 中实现删除和存储用户。所以,我创建了一个休息控制器(js 向他们传输数据):
@Autowired
private UserFeign userFeign;
//save controller
@RequestMapping(method = RequestMethod.POST, value = "/property/register")
public ResponseEntity<?> createUser(@RequestBody User user) {
userSaveFeign.createUser(user);
return ResponseEntity.ok();
}
// and delete controller
@RequestMapping(method = RequestMethod.DELETE, value = "/property/{id}")
public String hello(@PathVariable("id") String id){
userSaveFeign.delById(id);
}
return "hello";
}
Run Code Online (Sandbox Code Playgroud)
但它总是遇到错误:
2016-04-16 20:05:41.162 …
Run Code Online (Sandbox Code Playgroud) angular ×5
docker ×3
ng-bootstrap ×2
spring-cloud ×2
angular-cli ×1
boot2docker ×1
bootstrap-4 ×1
file ×1
file-upload ×1
forms ×1
java-time ×1
mongodb ×1
observable ×1
querydsl ×1
redis ×1
rxjs ×1
spring ×1
spring-boot ×1
spring-data ×1
spring-mvc ×1
typescript ×1