小编rad*_*ead的帖子

当我将输入标签作为孩子时,md 输入容器抛出错误

尝试使用 Angular 示例页面中的以下代码:

 <md-input-container>
    <label>Vegetables</label>
    <md-select ng-model="selectedVegetables"
               md-on-close="clearSearchTerm()"
               data-md-container-class="selectdemoSelectHeader"
               multiple>
      <md-select-header class="demo-select-header">
        <input ng-model="searchTerm"
               type="search"
               placeholder="Search for a vegetable.."
               class="demo-header-searchbox md-text">
      </md-select-header>
      <md-optgroup label="vegetables">
        <md-option ng-value="vegetable" ng-repeat="vegetable in vegetables |
          filter:searchTerm">{{vegetable}}</md-option>
      </md-optgroup>
    </md-select>
  </md-input-container>
Run Code Online (Sandbox Code Playgroud)

但这是我得到的错误:

错误:只能有一个子输入,textarea 或 select 元素!

该示例可以在这里找到(查找选择标题):https : //material.angularjs.org/latest/demo/select

html javascript input angularjs

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

正则表达式必须包含且可能仅包含

我想要一个python的正则表达式,它匹配一个必须包含4位数的字符串,它可能不包含除" - "或"."之外的任何特殊字符,并且它可能只包含大写字母.我知道以下匹配4位或更多的文本.我如何添加其余标准?

[0-9]{4,}

一个例子是: ART-4.5-11是好的,ART5411是好的,76543是好的,但aRT-4!5-11是坏的,因为它包含一个小写字符和一个不是" - "或"."的特殊字符. "

python regex

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

C++错误:嵌套名称说明符中使用的不完整类型

我有以下标头helper.h:

#ifndef ADD_H
#define ADD_H

class Helper{
public:
    static float calculateSpriteSize(float imgSize, float screenSize);
};

#endif
Run Code Online (Sandbox Code Playgroud)

这是我的helper.cpp:

#include "block.h"
#include "helper.h"

float Helper::calculateSpriteSize(float imgSize, float screenSize)
{
    return ((imgSize/screenSize)*100);
}
Run Code Online (Sandbox Code Playgroud)

但是,出于某种原因,当我在运行的代码上调用我的函数calculateSpriteSize时:

#include "header.h"


int main(void){
     float h = Helper::calculateSpriteSize( 168.0f, 170.0f );
)
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

错误:嵌套名称说明符中使用的不完整类型'Helper'

任何帮助,将不胜感激.

Block.h如下所示:

#ifndef ADD_H
#define ADD_H

class Block{
    private:
         int imgID;
         int life;
         float price;

    public:
         Block();

         void setImgID(int imgID);
         int getImgID();
    };

    #endif
Run Code Online (Sandbox Code Playgroud)

而block.cpp看起来如下:

#include "block.h"

Block::Block()
{

}

void Block::setImgID(int imgID)
{
     this->imgID …
Run Code Online (Sandbox Code Playgroud)

c++ compiler-errors incomplete-type

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

JGraphT:无论边缘方向如何寻找最短路径

我使用 JGraphT 构建了以下图 A->B<-C,如下所示:

    DirectedPseudograph<Node, Edge> graph = new DirectedPseudograph<>(Edge.class);
    DijkstraShortestPath<Node, Edge> shortestPath = new DijkstraShortestPath<Node, Edge>(graph);
    Node bn1 = new Node("1", "A", null);
    Node bn2 = new Node("2", "B", null);
    Node bn3 = new Node("3", "C", null);

    graph.addVertex(bn1);
    graph.addVertex(bn2);
    graph.addVertex(bn3);

    Edge edge1 = new Edge("PART_OF");
    Edge edge2 = new Edge("IS_A");
    graph.addEdge(bn1, bn2, edge1);
    graph.addEdge(bn3, bn2, edge2);
Run Code Online (Sandbox Code Playgroud)

但每当我尝试打电话时:

shortestPath.getPath(node1, node3);
Run Code Online (Sandbox Code Playgroud)

我得到一个空数组,这意味着没有连接。我知道这可能与边缘的方向有关,因为 A->B->C 工作正常。有没有办法无论A和C之间的边的方向如何都能找到路径?

java jgrapht shortest-path

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