小编Geo*_* C.的帖子

无法绑定到“ dataSource”,因为它不是“ mat-tree”的已知属性

由于某种原因,我收到此错误

无法绑定到“ dataSource”,因为它不是“ mat-tree”的已知属性。

我不知道该如何解决

我尝试使用角度材质2 6.0.0-beta.3,其中该版本首次具有treeview组件,对解决此错误的任何帮助都会有所帮助。

package.json

  "dependencies": {
    "@angular/animations": "^6.0.0-beta.5",
    "@angular/cdk": "^6.0.0-beta.4",
    "@angular/common": "^6.0.0-beta.5",
    "@angular/compiler": "^6.0.0-beta.5",
    "@angular/core": "^6.0.0-beta.5",
    "@angular/flex-layout": "^2.0.0-beta.12",
    "@angular/forms": "^6.0.0-beta.5",
    "@angular/http": "^6.0.0-beta.5",
    "@angular/material": "^6.0.0-beta.3",
    "@angular/material-moment-adapter": "^6.0.0-beta.5",
    "@angular/platform-browser": "^6.0.0-beta.5",
    "@angular/platform-browser-dynamic": "^6.0.0-beta.5",
    "@angular/router": "^6.0.0-beta.5",
    "@types/three": "^0.89.6",
    "core-js": "^2.4.1",
    "hammerjs": "^2.0.8",
    "moment": "^2.20.1",
    "ng2-truncate": "^1.3.11",
    "orbit-controls-es6": "^1.0.10",
    "rxjs": "^5.5.6",
    "stats.js": "^0.17.0",
    "three": "^0.89.0",
    "three-orbit-controls": "^82.1.0",
    "zone.js": "^0.8.19"
  },
Run Code Online (Sandbox Code Playgroud)

app.component.html

<mat-tree [dataSource]="data" [treeControl]="tc">
    <mat-tree-node *matTreeNodeDef="let node" matTreeNodeToggle>
        <li>
            <div>
                <button mat-icon-button disabled>
          <mat-icon>
            remove
          </mat-icon>
        </button>
        {{node.name}}
            </div>
        </li>
    </mat-tree-node> …
Run Code Online (Sandbox Code Playgroud)

angular-material2

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

如何在 Windows 10 x64 上使用 Bazel 构建和调试 c++ 可执行文件

我想使用生成的带有 bazel 的可执行文件来调试 c++ 代码,但由于某种原因,bazel 不在 x64 架构上构建代码,或者可执行文件在调试模式下不起作用。

我的文件是

主程序

#include <iostream>

int main()
{
    int a = 3;
    int b = 5;
    int c = a + b;

    /* code */
    std::cout << "Hello world" << std::endl;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我使用这个命令来构建我的应用程序

bazel build //src/app:main --strip=never --compilation_mode=dbg

但是当我在设置断点后尝试调试应用程序时,我在控制台中收到此错误

例如,如果我跑

gdb main.exe

然后

(gdb) 中断主要

我得到

没有加载符号表。

当我使用bazel build 命令构建代码时,如何在 main.exe 中加载符号?

c++ mingw bazel

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

如何在 VS Code 中包含自定义头文件

有人可以向我解释为什么当我在代码中包含头文件时,它没有在VS Code 中运行吗?(操作系统:Windows 10)

在此处输入图片说明

如果我运行此代码:

#include <iostream>

int main () {

    std::cout << "Hello from C++ " << std::endl;
}
Run Code Online (Sandbox Code Playgroud)

在VS代码工作正常,但如果我运行此代码:

#include <iostream>
#include "./lib/Methods.h"

int main () {

    int a = MyMethod(5);
    std::cout << "Hello from C++ " << std::endl;
    std::cout << "a = " << a << std::endl;
}
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

PS C:\Users\giorg\Documents\Development\Tests\node-addons-test\src> g++ main.cpp
C:\Users\giorg\AppData\Local\Temp\ccIQQEE1.o:main.cpp:(.text+0x1e): undefined reference to `MyMethod(int)' collect2.exe: error: ld returned 1 exit status PS
C:\Users\giorg\Documents\Development\Tests\node-addons-test\src>
Run Code Online (Sandbox Code Playgroud)

库/方法.cpp

int MyMethod(int x) …
Run Code Online (Sandbox Code Playgroud)

c++ g++ visual-studio-code

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

如何计算在Three.Js中保存的场景的所有顶点

如何计算Three.Js中保存的场景的所有顶点

有任何方法可以获得我在场景中的总顶点,如MAYA或3DS MAX ??

我有一些装有obj加载器的3d模型,我想知道如何获得我在场景中的总顶点或边或三角形.

喜欢scene.get(vertices);或scene.get(edges);

three.js

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

如何同时从travis部署多个firebase hostng项目(没有暂存或仅生产其他网站)

我想在可能的同时从Travis多个firebase托管项目部署??,如果是的话我会很高兴:)

因为我现在有10个项目,所有都是相同的代码,我认为我可以更容易地同时从1 git repo部署到我的所有网站,现在我在那个时间做了1个,需要4-5个小时要做到这一点

我的.travis.yml

language: node_js
node_js:
  - "7"

branches:
  only:
    - master

before_script:
  - npm install -g firebase-tools
  - npm install -g @angular/cli

script:
  - ng build --prod

after_success:

  - firebase deploy --token $FIREBASE_TOKEN_1 <-- this is for https://project1.firebaseapp.com
  - firebase deploy --token $FIREBASE_TOKEN_2 <-- this is for https://project2.firebaseapp.com
  - firebase deploy --token $FIREBASE_TOKEN_3 <-- this is for https://project3.firebaseapp.com
  - firebase deploy --token $FIREBASE_TOKEN_4 <-- this is for https://project4.firebaseapp.com
  - firebase deploy --token $FIREBASE_TOKEN_5 <-- this is for …
Run Code Online (Sandbox Code Playgroud)

travis-ci firebase firebase-hosting firebase-tools

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

如何在python flask服务器中保存base64镜像

我尝试保存来自HTTP post请求的base64图像字符串,出于某种原因,我得到了多个不同的错误

binascii.Error:填充不正确

此外,我看看这个StackOverflow问题但是没有工作 将base64中的字符串转换为图像并保存在Python中的文件系统中

但最后,我得到一个0字节的png文件

我的问题是如何在我的服务器文件系统上保存base64字符串图像

我收到这个错误

return binascii.a2b_base64(s)

我得到的是来自客户端的这种格式:

数据:图像/ JPEG; BASE64,/ 9J/4AAQSkZJRgABAQEASABIAAD/2wCEAAICAgICAgMCAgMFAwMDBQYFBQUFBggGBgYGBggKCAgIC ..... AgICgoKC/vuJ91GM9en4hT/AI3TLT8PoqYVw //ž

从客户端我发送此请求

{
      "img" : "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wCEAAICAgICAgMCAgMFAwMDBQYFBQUFBggGBgYGBggKCAgIC.....AgICgoKC/vuJ91GM9en4hT/AI3TLT8PoqYVw//Z"
}
Run Code Online (Sandbox Code Playgroud)

在我的python代码中,我有这个方法来读取和保存base64图像

@app.route('/upload', methods=['POST']) 
def upload_base64_file(): 
    """ 
        Upload image with base64 format and get car make model and year 
        response 
    """

  data = request.get_json()
  # print(data)

  if data is None:
      print("No valid request body, json missing!")
      return jsonify({'error': 'No valid request body, json missing!'})
  else:

      img_data = data['img']

      # this method convert and save the base64 string …
Run Code Online (Sandbox Code Playgroud)

base64 image flask python-3.x

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

在angular 6项目中使用@ tensorflow / tfjs时出错

我已经生成了一个没有其他依赖项的angular 6项目,该项目是超级干净的,唯一的依赖项是@ tensorflow / tfjs

如果我在localhost:4200上为我的项目提供服务,则会收到以下消息:

找不到模块:错误:无法在C:\ User \ user \ bla \ bla中解析“ crypto” 在此处输入图片说明

问题是我想要tensorflow仅在最近5个版本上支持的功能,而我从0.11.1及更高版本中选择的任何版本总是无法编译或在Web Pack开始捆绑代码时失败。

这是我在tensorflow.js上发布的GitHub问题,但尚未解决。 https://github.com/tensorflow/tfjs/issues/494

可以在此处找到实时代码。

https://stackblitz.com/edit/angular-eu4cjy

这里也是代码示例

app.component.ts

import { Component, OnInit } from '@angular/core';
import * as tf from '@tensorflow/tfjs';


@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
})
export class AppComponent  implements OnInit  {



  // TRAINING DATA.
  x_train = tf.tensor2d([[0, 0], [0, 1], [1, 0], [1, 1]]);
  y_train = tf.tensor2d([[0], [1], [1], [0]]);

  // Defining a model.
  model: tf.Sequential;

  prediction: any;

  constructor() …
Run Code Online (Sandbox Code Playgroud)

angular tensorflow.js

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