小编cod*_*349的帖子

UnhandledPromiseRejectionWarning:错误:npm 启动后用户“”的密码验证失败

我正在使用节点版本 8,当我执行 npm start 时,会看到以下错误。我猜在创建路由后会看到以下错误。这里“techwedge3”是我系统的用户名。即使出现以下错误,该应用程序也能正常工作。即使我能够连接到我的 postgres 数据库。关于如何解决问题的任何想法?

[JobRoute::create] Creating route.
[InterviewRoute::create] Creating route.
[Creating AdminRoute::create] Creating route.
[TenantRoute::create] Creating route.
[CriteriaRoute::create] Creating route.
(node:12212) UnhandledPromiseRejectionWarning: error: password authentication failed for user "techwedge3"
    at Connection.parseE (C:\Development\vilearnnew\vilearn_node\node_modules\pg-promise\node_modules\pg\lib\connection.js:546:11)
    at Connection.parseMessage (C:\Development\vilearnnew\vilearn_node\node_modules\pg-promise\node_modules\pg\lib\connection.js:371:19)
    at Socket.<anonymous> (C:\Development\vilearnnew\vilearn_node\node_modules\pg-promise\node_modules\pg\lib\connection.js:114:22)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
Run Code Online (Sandbox Code Playgroud)

postgresql node.js typescript

8
推荐指数
0
解决办法
8531
查看次数

使用 bootstrap4 的可滚动表体

使用 Bootstrap-4我无法为带有固定标题的表格主体应用滚动。我正在使用 min-height 以及溢出来将滚动应用于表格主体。bootstrap4 不支持在表体上滚动吗?下面的片段更清楚地解释了这个问题。

我是不是哪里出错了?

.tbody {
  min-height:10px;
  overflow-y:scroll;
}
Run Code Online (Sandbox Code Playgroud)
 <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  
  
  <div class="container">
          
  <table class="table table-bordered">
    <thead>
      <tr>
        <th>Firstname</th>
        <th>Lastname</th>
        <th>Email</th>
      </tr>
    </thead>
    <tbody class="tbody">
      <tr>
        <td>John</td>
        <td>Doe</td>
        <td>john@example.com</td>
      </tr>
      <tr>
        <td>Mary</td>
        <td>Moe</td>
        <td>mary@example.com</td>
      </tr>
      <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
      </tr>
    </tbody>
  </table>
</div>
Run Code Online (Sandbox Code Playgroud)

html css bootstrap-4

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

滚动顶部在 Angular2 中无法正常工作

我创建了一个表,其中行被动态填充。我有一个添加按钮,我也可以在其中添加行。在这里,我想在添加行后在底部的表格中显示新添加的行,所以我使用下面的代码是 component.ts。

this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
Run Code Online (Sandbox Code Playgroud)

但上面的代码似乎不能正常工作。问题是,当我添加新行时,滚动并没有完全到达 div 标签的底部,因此看不到新行。

下面是我的 html 代码,我在 div 标签内使用表格,如下所示。

<div style="height:200px;overflow-y:auto">
    <table class="table table-bordered table-hover">
        <thead>
        <tr class="d-flex">
            <th class="col-3">Q.No</th>
            <th class="col-4">Record Answer</th>
        </tr>
        </thead>
        <tbody>
        <tr *ngFor="let answer of answerPaper; let i = index" class="d-flex">
            <td class="col-3">answer.no</td>
            <td class="col-4">answer.name</td>
        </tr>
        </tbody>
    </table>
</div>
<button (click)="addrow()">Add Row</button>
Run Code Online (Sandbox Code Playgroud)

下面是component.ts

public addRow(){
    this.answerPaper.push({});
}
Run Code Online (Sandbox Code Playgroud)

我也发布了滚动条的图像。

当我添加新行时,滚动条没有完全移动到 div 底部,因此新添加的行没有完全看到

当我添加新行时,滚动条没有完全移动到 div 底部,因此新添加的行没有完全看到

我是不是哪里出错了?

html javascript angular

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

找不到非具体 Map 类型的反序列化器 [map type; 类 com.google.common.collect.ImmutableMap

我使用 java 作为后端,从 UI 发送的请求JSON格式如下所示。

{"name":"Music"}
Run Code Online (Sandbox Code Playgroud)

下面是java代码。

@PostMapping(consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE},produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
    public Category insertCategory(@RequestBody Category category) {
        // TODO Auto-generated method stub
        System.out.println("entity:" +category.getName());
        CategoryServiceImpl impl = new CategoryServiceImpl();
        Category res = impl.insertCategory(category);
        return res;
    }
Run Code Online (Sandbox Code Playgroud)

返回到 UI 的响应应该是json这样,我使用了生产方式,MediaType.APPLICATION_JSON_VALUE如您所见。

请求正文还将json数据绑定到 Category 模型对象,但这是我收到反序列化错误的地方(错误日志如下所示)。

类别模型如下所示。

public class Category extends Entity {
    private ImmutableMap<String,Category> childCategories;

    public ImmutableMap<String, Category> getChildCategories() {
        return childCategories;
    }
    public void setCategories(Map<String,Category> categories) {
        ImmutableMap.Builder<String, Category> builder = …
Run Code Online (Sandbox Code Playgroud)

java rest json

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

检查angular2中对象数组中的重复值

我有一个要求,我只需要检查对象数组中的重复描述。下面是对象示例。

traveler = [
   {  description: 'Senior', Amount: 50},
   {  description: 'Senior', Amount: 10},
   {  description: 'Adult', Amount: 75},
   {  description: 'Child', Amount: 35},
   {  description: 'Infant', Amount: 25 },
   {  description: 'Adult', Amount: 105},
];
Run Code Online (Sandbox Code Playgroud)

在上面的数组traveler中有重复描述的对象,那么如何在整个数组中只检查重复的描述并显示一条消息。

我正在使用reduce方法,下面是代码。但控制不在 if 循环内

我在某个地方出错了吗?

var res = traveler.reduce((acc, obj)=>{
         var existItem = acc.find(item => item.description === obj.description);
            if(existItem){
                return this.toaster.pop('info', 'Insertion unsuccessful', 'Duplicate answer found')
            } 
           });
Run Code Online (Sandbox Code Playgroud)

angular

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

标签 统计

angular ×2

html ×2

bootstrap-4 ×1

css ×1

java ×1

javascript ×1

json ×1

node.js ×1

postgresql ×1

rest ×1

typescript ×1