小编sgr*_*lon的帖子

Leaflet - 创建一个带有 latLon + 距离(米)+ 角度(度)的标记

如何计算距标记 A 给定距离(以米为单位)和给定角度(以度为单位)处的新点(标记 B)?

Google API 有这个,但我在 Leaflet 中找不到它:

var pointA = new google.maps.LatLng(25.48, -71.26); 
var radiusInKm = 10;
var pointB = pointA.destinationPoint(90, radiusInKm);
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

javascript leaflet

5
推荐指数
1
解决办法
3535
查看次数

在Springboot 1.x中将netflix feign迁移到Springboot 2.x中的openfeign

我尝试将Springboot 1.xy(Brussels-SR12)迁移到我使用的2.xy FeignClients

我更改Maven配置:

<spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
Run Code Online (Sandbox Code Playgroud)

所以

<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign</artifactId>
<version>2.0.0.RELEASE</version>
Run Code Online (Sandbox Code Playgroud)

我更改所有导入:

import org.springframework.cloud.netflix.feign.EnableFeignClients;

import org.springframework.cloud.netflix.feign.FeignClient;
Run Code Online (Sandbox Code Playgroud)

import org.springframework.cloud.openfeign.EnableFeignClients;

import org.springframework.cloud.openfeign.FeignClient;
Run Code Online (Sandbox Code Playgroud)

我使用此接口:

@FeignClient(value = "COMPANY", fallbackFactory = CompanyClientFallbackFactory.class, configuration = FeignConfiguration.class)
public interface CompanyClient extends CompanyApi {
}
Run Code Online (Sandbox Code Playgroud)

当我运行JUnit测试(使用spring上下文)时,我现在遇到此错误(不在Springboot 1.xy和旧的netflix包中):

The bean 'COMPANY.FeignClientSpecification', defined in null, could not be registered. A bean with that name has already been defined in null and overriding is disabled.
Run Code Online (Sandbox Code Playgroud)

完整跟踪:

java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125)
    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108)
    at org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener.postProcessFields(MockitoTestExecutionListener.java:99)
    at org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener.injectFields(MockitoTestExecutionListener.java:79)
    at org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener.prepareTestInstance(MockitoTestExecutionListener.java:54)
    at …
Run Code Online (Sandbox Code Playgroud)

java spring spring-boot netflix-feign spring-cloud-feign

5
推荐指数
3
解决办法
3070
查看次数

如何在材质对话框 (MatDialog) 上自定义 ngx-material-timepicker 的 css z-index (more 1000)?

ngx-timepicker-field的在MatDialog。当我的时间选择器显示时,他在MatDialog模态弹出窗口的后面。

constructor(public dialog: MatDialog) { }

const dialogRef = this.dialog.open(PopupComponent, {
    data: {
        ...
    },
    position: {
        top: '50px'
    }
});
Run Code Online (Sandbox Code Playgroud)

弹出组件:

@ViewChild('sendAlertHour', {static: false} ) sendAlertHour:  NgxTimepickerFieldComponent;

<div>
    <ngx-timepicker-field #sendAlertHour></ngx-timepicker-field>
</div>
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

angular-material angular

5
推荐指数
2
解决办法
2665
查看次数

@Valid 注释在 spring boot 中不起作用

这是一个场景,一个用注释的控制器@RestController和一个需要验证参数的PUT方法@RequestBody。我@Valid在参数和 上使用注释@NotNull@Min对 bean 字段使用注释,但它们不起作用。

代码在这里:

豆:

public class PurchaseWrapper {
  @DecimalMin(value = "0.00",message = "discount must be positive")
  @NotNull
  private BigDecimal discount;
  @NotNull
  private Long merchandiseId;
  @NotNull
  private Long addressId;
  @Min(1)
  @NotNull
  private Integer count;
}
Run Code Online (Sandbox Code Playgroud)

控制器

@RestController
@RequestMapping("merchandises")
public class MerchandiseController {

@RequestMapping(value = "purchase",method = RequestMethod.PUT)
public ResponseEntity<RestEntity> purchase(@Valid @Validated @RequestBody PurchaseWrapper purchaseWrapper,
                                           @RequestParam String token){
    return new ResponseEntity<>(merchandiseService.purchase(purchaseWrapper,token),HttpStatus.OK);
}

@Autowired
PurchaseWrapperValidator purchaseWrapperValidator;

@InitBinder(value = "purchaseWrapper") …
Run Code Online (Sandbox Code Playgroud)

java validation spring spring-boot

4
推荐指数
1
解决办法
2万
查看次数

如何使用variable.scss更改引导程序中主按钮的颜色?

我使用一个variable.scss文件来自定义我的按钮。我的问题是NOT USE CSS but SCSS ONLY

我从更改原色 (#66cccc) 和字体 (RobotoSlab) 开始:

$primary: #66cccc;
$font-family-base: RobotoSlab;
Run Code Online (Sandbox Code Playgroud)

但我想要白色的文字(见屏幕截图)但我的字体是黑色的

在此处输入图片说明

bootstrap 根据原色计算黑色/白色(如果它很暗或很亮)

sass twitter-bootstrap

4
推荐指数
1
解决办法
1221
查看次数

chromeWebdriver - 当我将 Chrome 更新到 77 时无法设置 cookie

我将 Chrome 和 chromewebdriver 更新到版本 77。在此之后,unable to set cookie当我addCookie.

System.setProperty("cookie", "auth=ok,path=/");
int indexValue = cookieStr.indexOf('=');
int indexPath = cookieStr.indexOf(",path=");
String cookieName = cookieStr.substring(0, indexValue);
String cookieValue = cookieStr.substring(indexValue + 1, indexPath);
String cookieDomain = new URI("http://localhost").getHost().replaceAll("self.", "");
String cookiePath = cookieStr.substring(indexPath + 6);
Cookie authCookie= new Cookie.Builder(cookieName, cookieValue).domain(cookieDomain).path(cookiePath).expiresOn(new SimpleDateFormat("dd/MM/yyyy").parse("31/12/2020")).build();
System.out.println("A");
driver.navigate().to("http://localhost:8000/unprotected");
System.out.println("B");
driver.get("http://localhost:8000/404");
System.out.println("C");
System.out.println("[" + driver.getPageSource()+"]");
Options b = a.manage();
System.out.println("Domain: " + cookie.getDomain());
System.out.println("Name: " + cookie.getName());
System.out.println("Path: " + cookie.getPath());
System.out.println("Value: " + …
Run Code Online (Sandbox Code Playgroud)

java selenium selenium-chromedriver

4
推荐指数
1
解决办法
363
查看次数

如何隐藏材质按钮?

我想隐藏我的材料按钮,但它不起作用。

我的按钮是灰色的(OK):

<button mat-raised-button class="mat-primary" (click)="deleteClick()" [disabled]="data.createMode">
    <mat-icon>delete_forever</mat-icon>DELETE
</button>
Run Code Online (Sandbox Code Playgroud)

显示我的按钮(确定未隐藏):

<button mat-raised-button class="mat-primary" (click)="deleteClick()" [hidden]="data.createMode">
    <mat-icon>delete_forever</mat-icon>DELETE
</button>
Run Code Online (Sandbox Code Playgroud)

angular-material material-ui angular

4
推荐指数
1
解决办法
8732
查看次数

如何在 Python 3.x 中禁用 chrome webdriver 上的调试器?

有人知道如何在 Python 3.6 中禁用 chrome webdriver 中的调试器/日志记录吗?

在此处输入图片说明

我正在尝试以下代码,但它不起作用。

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--disable-infobars")
chrome_options.add_argument("--disable-logging")
chrome_options.add_argument("--disable-login-animations")
chrome_options.add_argument("--disable-notifications")
chrome_options.add_argument("--disable-default-apps")

driver = webdriver.Chrome(chrome_options=chrome_options, service_log_path='NUL', service_args=["--verbose", r"--log-path=D:\qc1.log"])
Run Code Online (Sandbox Code Playgroud)

Python 版本:3.6.1

Chrome 浏览器版本:62.0.3202.94(64 位)

网络驱动程序版本:2.33

操作系统:Win10(64位)

python debugging selenium google-chrome webdriver

3
推荐指数
1
解决办法
2306
查看次数

AWS Lambda Node Js - 如果存在则递增值,否则添加元素

我想要增量值(如果存在),否则添加元素。

+-----------------------+
| id | iteration | data |
+-----------------------+
| 10 |         1 | foo1 |
| 11 |         1 | foo2 |
| 12 |         2 | foo3 |
+-----------------------+
Run Code Online (Sandbox Code Playgroud)

我的代码:

var AWS = require('aws-sdk');
var documentClient = new AWS.DynamoDB.DocumentClient({'region': 'eu-west-1'}); 
exports.handler = function(event, context, callback) {

var params = {
  Item: {
    id: uuid,
    iteration: 1,
    data: body.data
  },
  TableName: "my-table"
};

documentClient.put(params, function(err, data) {
    if (err) {
      console.log("Error", err);
      const errResponse = {
        statusCode: 500, …
Run Code Online (Sandbox Code Playgroud)

node.js amazon-dynamodb aws-lambda

3
推荐指数
1
解决办法
2155
查看次数

Jenkins 管道和条件阶段

我想在所有阶段添加一个条件:

pipeline {
    agent { label 'unix' }
    options {
        buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '5'))
    }
    when {branch 'master' }
    stages {
   
    }
}
Run Code Online (Sandbox Code Playgroud)

我找到了添加when每个选项的任何解决方法steps,但我正在寻找一种只有一个的解决方案when

stage('master-branch-stuff') {
    when {
        branch 'master'
    }
    steps {
        echo 'run this stage - ony if the branch = master branch'
    }
}
Run Code Online (Sandbox Code Playgroud)

jenkins-pipeline

3
推荐指数
1
解决办法
6427
查看次数