小编Gar*_*Jax的帖子

DynamoDB - AWS CLI - 批量写入项目仅插入一行

我使用此 AWS CLI 命令创建了一个表:

aws dynamodb create-table --table-name test_table --attribute-definitions AttributeName=time_stamp,AttributeType=N AttributeName=watch_uuid,AttributeType=S --key-schema AttributeName=watch_uuid,KeyType=HASH AttributeName=time_stamp,KeyType=RANGE --billing-mode PROVISIONED --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1
Run Code Online (Sandbox Code Playgroud)

然后我尝试使用以下命令插入两行:

aws dynamodb batch-write-item --request-items file://items.json.1.batch.write.txt
Run Code Online (Sandbox Code Playgroud)

和这个文件内容:

{
    "test_table": [
        {
            "PutRequest": {
                "Item": {
                    "owner_name": {
                        "S": "Test watch 3"
                    },
                    "time_stamp": {
                        "N": "1541524533453"
                    },
                    "watch_uuid": {
                        "S": "A9A0E8B2-CD8D-464A-8787-383A85919A06_1541524533453_Test watch 3"
                    },
                    "y_user_accel": {
                        "S": "0.07286"
                    }
                }
            },
            "PutRequest": {
                "Item": {
                    "owner_name": {
                        "S": "Test watch 4"
                    },
                    "time_stamp": {
                        "N": "1541524533765"
                    },
                    "watch_uuid": {
                        "S": "A9A0E8B2-CD8D-464A-8787-383A85919A06_1541524533453_Test …
Run Code Online (Sandbox Code Playgroud)

command-line-interface amazon-web-services amazon-dynamodb

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

使用 react / react-bootstrap / flexbox 居中图像

我正在使用版本:

react@16.8.6
react-bootstrap@1.0.0-beta.8
Run Code Online (Sandbox Code Playgroud)

我对在 react、react-bootstrap 和 flexbox 之间应该做什么感到有些困惑。我在名为 LoginImage.js 的文件中有一个简单的图像定义:

import React, { Component } from 'react'
import { Image } from "react-bootstrap";

class LoginImage extends Component {
  render() {
    return (
      <Image width="150" src="/staff_login.jpg" />
    );
  }
}

export default LoginImage;
Run Code Online (Sandbox Code Playgroud)

我在 App.js 文件中使用它,如下所示:

import LoginImage from './LoginImage'
...
    <Container>
      <Row>
        <Col xs={12} sm={4} md={4}>
          <LoginImage />
        </Col>
      </Row>
    </Container>
Run Code Online (Sandbox Code Playgroud)

我知道 CSS3 和 Flexbox 分别提供“justify-content”和“align-items”来水平和垂直定位,但不清楚我应该在上面的代码中在哪里使用它们,或者这是否是最好的方法根据我上面的内容将图像居中。

我很感激任何帮助。谢谢。

javascript flexbox reactjs react-bootstrap

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

org.codehaus.jackson.map.exc.UnrecognizedPropertyException:无法识别的字段“errorMessages”(ReasonDTO 类),未标记为可忽略

我正在尝试将从 REST 服务调用返回的 JSON 解析回 DTO 对象,以便可以在客户端使用它。客户端代码如下所示:

@Test
public void retrieveAllReasonsUsingJSONandGet() throws Exception {
    List<Object> providers = new ArrayList<Object>();
    providers.add(new org.codehaus.jackson.jaxrs.JacksonJsonProvider());

    WebClient client = WebClient.create(endpointUrl + "/retrieveall", providers);

    Response r = client.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON).get();
    assertEquals(Response.Status.OK.getStatusCode(), r.getStatus());

    MappingJsonFactory factory = new MappingJsonFactory();
    JsonParser parser = factory.createJsonParser((InputStream)r.getEntity());
    TypeReference<List<ReasonDTO>> ref = new TypeReference<List<ReasonDTO>>() {} ;
    List<ReasonDTO> allReasons = (List<ReasonDTO>) parser.readValueAs(ref);

    assertEquals(43, allReasons.size());
} // retrieveAllReasonsUsingJSONandGet
Run Code Online (Sandbox Code Playgroud)

返回的 JSON 的一节(共有 43 个)如下所示:

{
    "reasonCode": "...",
    "reason": "...",
    "hasError": false,
    "errorMessages": [],
    "hasWarning": false,
    "warningMessages": []
},
Run Code Online (Sandbox Code Playgroud)

DTO …

json

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

HTML CSS使DIV,只要内容不在窗口中

我有一个简单的登录表单,该表单允许用户执行一些其他操作。所有这些都在浏览器中打开一个“模式”窗口。只要登录表单的内容不超出屏幕范围,那么一切都很好。当它打开并且用户向下滚动时,模式部分仅覆盖浏览器的大小,因此该表单的其余部分将不被覆盖。这使他们可以打开第二个模态块。

我的模式块的CSS是:

.modal-content {
  background-color: #fefefe;
  margin: 5% auto 15% auto; /* 5% from the top, 15% from the bottom and centered */
  border: 1px solid #888;
  width: 40%; /* Could be more or less, depending on screen size */
  padding: 16px;
}
Run Code Online (Sandbox Code Playgroud)

我的不透明覆盖的CSS是:

.modalpwd {
  display: none; /* Hidden by default */
  z-index: 1; /* Sit on top */
  overflow: visible;
  align-self: center;  
  position: absolute;
  left: 0;
  top: 0; 
  margin-left: 0;
  margin-top: 0;
  width: 100%; /* Full width */ …
Run Code Online (Sandbox Code Playgroud)

html javascript css modal-dialog

0
推荐指数
1
解决办法
48
查看次数