小编kis*_*Tae的帖子

当 span 的高度和宽度为 0 且仅 padding-left 设置为 20px 时,padding 仍然存在

这是我的设置:

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
span {
  padding-left: 25px;
  background: red;
}
Run Code Online (Sandbox Code Playgroud)
<span></span>
Run Code Online (Sandbox Code Playgroud)

我有设置为box-sizing:border-box和的 span 标签padding-left:25px。当这个span标签中没有任何值时,它的heightwidth0。所以我希望span标签不会显示在网页上。但是,它仍然存在,我认为这是因为 padding-left 的原因。但我只设置了padding-left所以它仍然没有高度可显示。但是正如你在jsfiddle中看到的,padding显示在网页上......

为什么会发生这种情况?

html css

6
推荐指数
1
解决办法
1013
查看次数

PostGIS 使用 epsg 5186 将米转换为度

我有一些关于 PostGIS 中的几何和地理的问题。

我目前正在使用 PostGIS 和 Postgresql。

我的大部分空间数据来自韩国,基本上是纬度和经度。

为了进行测试,我创建了两个具有相同纬度和经度数据但数据类型不同的表,一个用于 SRID 4326 的地理,另一个用于 SRID 5186 的几何。

create table geometry_stores
(
    id       serial primary key,
    location geometry(POINT, 5186) not null
);

create table geography_stores
(
    id       serial primary key,
    location geography(POINT, 4326) not null
);
Run Code Online (Sandbox Code Playgroud)

您可以在此链接上找到 EPSG 5186 的更多详细信息https://epsg.io/5186

这是我收到的问题清单:

  1. PostGIS有这个方法

    ST_DWithin(geometry g1, geometry g2, double precision distance_of_srid);

    distance_of_sridEPSG的单位吗?有什么方法可以将米(例如 1 公里)转换为distance_of_sridEPSG 5186 吗?

  2. 据我所知,地理计算将点之间的距离测量为球体上的真实路径,而几何计算将点之间的距离测量为笛卡尔平面上的真实路径。那么,如果我给以下查询提供完全相同的距离,它们应该产生不同的结果还是相同的结果?因为我的理解是,SRID 5186 的几何图形已经在地球变形的情况下进行投影,那么它们应该产生相同的结果?

    select *
    from geography_stores
    where st_dwithin(location, st_setsrid(st_point(126.970769, 37.555479), 4326), same_distance_meter)
    
    Run Code Online (Sandbox Code Playgroud)
    select …
    Run Code Online (Sandbox Code Playgroud)

postgresql postgis

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

在控制器中传递服务的功能以不复制 try catch 块

我正在使用 Hibernate 在 Spring Boot 中开发 REST API。

我的控制器中有这个功能

@PostMapping("/profile")
public ResponseEntity<String> saveProfile(@Valid @RequestBody SaveProfileVM saveProfileVM,
                                          BindingResult bindingResult)
throws JsonProcessingException {

    if (bindingResult.hasErrors()) return super.fieldExceptionResponse(bindingResult);

    Profile profile;

    boolean optimisticLockException = true;
    int retryCount = 0;

    do {
        try {
            profile = accountService.saveProfile(saveProfileVM.getAccountId(),
                                                 saveProfileVM.getName(),
                                                 saveProfileVM.getEmail());

            optimisticLockException = false;
            retryCount++;

        } catch (ObjectOptimisticLockingFailureException exception) {
            retryCount++;
            System.out.println(exception.getMessage());
        }
    } while (optimisticLockException && retryCount < MAX_OPTIMISTIC_LOCK_EXCEPTION_RETRY_COUNT);

    return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(profile));
} 
Run Code Online (Sandbox Code Playgroud)

并且MAX_OPTIMISTIC_LOCK_EXCEPTION_RETRY_COUNT是 3

我不想do..while and try..catch blocks在需要检查的每个方法中复制ObjectOptimisticLockingFailureException

do { 
   try{} …
Run Code Online (Sandbox Code Playgroud)

lambda hibernate controller function spring-boot

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