小编Mat*_*ann的帖子

如何在Angular 4中使用Material Design Icons?

我想在我的angular 4项目中使用https://materialdesignicons.com/中的图标.网站上的说明仅涵盖如何将其包含在Angular 1.x(https://materialdesignicons.com/getting-started)中

如何包含材料设计图标,以便我可以像<md-icon svgIcon="source"></md-icon>使用Angular Materialng serve?一样使用它们?

注意:我已经包含了google material icons哪些是不同的!

angular-material2 angular

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

Mongodb - 如何调试聚合步骤?

如何使用mongodbnode.js Node.js Mongodb 驱动程序的本机驱动程序调试 MongoDb 聚合步骤

我通过谷歌搜索找到的是这个npm包:https : //www.npmjs.com/package/mongo-aggregation-debugger

还有其他选择吗?

debugging mongodb node.js aggregation-framework

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

Mongodb node.js $ out with aggregation仅在调用toArray()时有效

保存使用聚合查询"mongodb": "^3.0.6"与结果$out时调用运营商只工作.toArray().

聚合步骤:

let aggregationSteps = [{
    $group: {
        _id: '$created_at',
    }
}, {'$out': 'ProjectsByCreated'}];
Run Code Online (Sandbox Code Playgroud)

执行聚合:

await collection.aggregate(aggregationSteps, {'allowDiskUse': true})

预期结果:名为ProjectsByCreated的新集合.

结果:没有集合,查询不会抛出异常但是没有被执行?(只需1毫秒)

toArray()在预期行为中附加结果:

await collection.aggregate(aggregationSteps, {'allowDiskUse': true}).toArray();

为什么mongodb只在调用时创建结果集合.toArray(),文档在哪里这样说?我怎样才能解决这个问题?

该文档似乎没有提供任何有关此信息:

mongodb node.js aggregation-framework

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

Http请求状态码405 ReasonPhrase:''Youtube APi

我尝试发送这两个请求,但我只得到标题中列出的错误作为响应.我对谷歌服务器的两个网络请求是这样的:

HttpClient http = new HttpClient();

HttpResponseMessage response = await http.GetAsync("https://accounts.google.com/o/oauth2/token?code="+localSettings.Values["AccessKey"]+"&client_id=XX-XXXXXXXXXX.apps.googleusercontent.com&client_secret=XXXXX-XXXX&redirect_uri=http://localhost/oauth2callback&grant_type=authorization_code");

//response.EnsureSuccessStatusCode();
Debug.WriteLine(response.ToString());
HttpResponseMessage response1 = await http.GetAsync("https://content.googleapis.com/youtube/v3/subscriptions?part=id&maxResults=10&mine=true&key="+localSettings.Values["AccessKey"]);
Debug.WriteLine(response1.ToString());
Run Code Online (Sandbox Code Playgroud)

我从调试器获得以下输出:

StatusCode: 405, ReasonPhrase: '', Version: 2.0, Content: System.Net.Http.StreamContent, Headers:
{
  server: GSE
  alt-svc: quic=":443"; p="1"; ma=604800
  cache-control: max-age=0, private
  accept-ranges: none
  date: Tue, 29 Sep 2015 16:05:03 GMT
  x-frame-options: SAMEORIGIN
  vary: Accept-Encoding
  x-content-type-options: nosniff
  alternate-protocol: 443:quic,p=1
  x-xss-protection: 1; mode=block
  content-type: application/json
  expires: Tue, 29 Sep 2015 16:05:03 GMT
}
StatusCode: 400, ReasonPhrase: '', Version: 2.0, Content: System.Net.Http.StreamContent, Headers:
{
  server: …
Run Code Online (Sandbox Code Playgroud)

c# api response httprequest http-error

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

Three.js场景切换性能问题

我在three.js中创建了一个游戏,其中包含3个场景GameScene,MenuScene以及HighScoreScene.当玩家从不断变化的场景如-用户可以将这些场景之间切换MenuSceneHighScoreScene我试图从旧场景清理资源.

但清理资源似乎不起作用.所以这是我的代码,当用户在场景之间切换时,它会被执行:

所以在旧场景中我有这个动画循环:

 function cancelAnimation() {
    cancelAnimationFrame(animationFrameId); // EXECUTING WHEN SWITCHING SCENE!!!
 }

function animate() {
    animationFrameId = requestAnimationFrame(animate); // Saving id
    render();
}

function render() {
    renderer.clear();
    renderer.render(scene, camera);
}
Run Code Online (Sandbox Code Playgroud)

因此,当切换场景时,我取消设置所有点击监听器,我正在呼叫cancelAnimation.

因为我将每个场景的代码存储在一个对象中,就像var menuScene = new MenuScene()menuScene = undefined在切换场景时也这样做.

我也传递相同var renderer = new THREE.WebGLRenderer();的场景实例.

这一切似乎都没有帮助游戏执行得更慢.

在这些场景之间切换和清理资源的正确方法是什么?我在这做错了什么?

javascript performance three.js

5
推荐指数
0
解决办法
159
查看次数

在 C++ 项目中链接 Paho C Mqtt 库错误

我正在尝试将MQTT-C-Client-Library包含在一个简单的 C++ 项目中。我已经像这样成功包含了头文件#include "MQTTClient.h"。在 Linux 终端中编译它会打印以下错误:

[xy@localhost mosquittoProject]$ sudo g++ *.cpp -o MQTTTest
/tmp/ccHn3s6m.o: In function `main':
mosquitto_test.cpp:(.text+0x11e): undefined reference to `MQTTClient_create'
mosquitto_test.cpp:(.text+0x13f): undefined reference to `MQTTClient_connect'
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

经过一番谷歌搜索后,我发现我需要链接该库:Example MQTT Client Code not work C

基于这个问题和答案,我尝试再次编译它,如下所示:

sudo g++ -L/home/xy/Desktop/paho.mqtt.c/build/output/ *.cpp -l paho-mqtt3c -o MQTTTest

编译得很好,但运行时仍然出现错误。控制台命令和输出:

[xy@localhost mosquittoProject]$ sudo g++ -L/home/xy/Desktop/paho.mqtt.c/build/output/ *.cpp -l paho-mqtt3c -o MQTTTest
[xy@localhost mosquittoProject]$ ./MQTTTest 
./MQTTTest: error while loading shared libraries: libpaho-mqtt3c.so.1: cannot open shared object …
Run Code Online (Sandbox Code Playgroud)

c c++ linker mqtt paho

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

使用 terraform 和 efs 的 AWS ECS 任务定义 - 未知卷

我正在尝试保留容器数据,为此我想安装一个卷。这是我的任务定义,尽管声明了它,但它仍抛出未知卷错误。

aws_ecs_task_definition.wordpress:正在创建...错误:ClientException:未知卷“wordpress-volume”。

    locals {
      username = jsondecode(data.aws_secretsmanager_secret_version.wordpress.secret_string)["username"]
      password = jsondecode(data.aws_secretsmanager_secret_version.wordpress.secret_string)["password"]
    }
    
    resource "aws_ecs_task_definition" "wordpress" {
      family                = "wordpress"
      container_definitions = jsonencode([{
        name = "wordpress"
        image = "wordpress"
        essential = true
        cpu = 256
        memory = 512
        entryPoint = [ "sh", "-c"]
        command = ["ls -la /var/www/html"]
        volumes = [{
          name = "wordpress-volume"
          efsVolumeConfiguration = {
            fileSystemId = aws_efs_file_system.wordpress.id
          }
        }]
        mountPoints = [{
          sourceVolume = "wordpress-volume"
          containerPath = "/var/www/html"
          readOnly = false
        }]
        environment = [{
          name = "WORDPRESS_DB_HOST"
          value …
Run Code Online (Sandbox Code Playgroud)

amazon-ecs docker terraform amazon-efs

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

Azure 管道根据条件设置任务的显示名称

在构建管道中,我有一个使用 powershell 脚本的工作,根据这样的变量设置应用程序名称:

$applicationName = If ('$(configuration)' -eq 'Release') { 'Appname' } Else { 'Appname-Test' }
Write-Host "##vso[task.setvariable variable=applicationName]$applicationName"
Run Code Online (Sandbox Code Playgroud)

我尝试将PublishBuildArtifacts@1变量的显示名称设置为这样的变量:

  - task: PublishBuildArtifacts@1        
    displayName: $[variables.applicationName] #  runtime variable
Run Code Online (Sandbox Code Playgroud)

但这从字面上显示$[variables.applicationName]而不是变量值。如何根据变量更改任务的显示名称?

azure-devops azure-pipelines-build-task azure-pipelines

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

ListView 将 ListViewHeaderItem 保持在顶部

我首先解释我想要实现的目标:

字母“A”是我的 Listview 中的一个 ListViewHeaderItem。没有滚动列表的顶部是这样的。

我的 ListView 没有滚动

在我滚动 ListViewHeaderItem 后,“A”与其余项目一起向下移动 - 但我怎样才能实现 Header 作为第一个项目的种类保持在顶部,直到带有 ist 子项目的字母“B”到来?我想要实现的行为的一个例子是微软为 Windows 10 提供的官方“邮件”应用程序。它将日期时间保持在顶部,直到一天前写的电子邮件到来。

我不知道这个问题是否已经存在,但我不知道它是怎么称呼的,我不知道谷歌是为了什么。

c# xaml listview header uwp

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

Javascript LocalStorage Null Bug

我在这样的localstorage中保存元素(使用严格模式):

localStorage.setItem(String(index), JSON.stringify([name, score]));

然后我写了一个方法来检查新分数是否大于保存的分数:

    // Returns index where to place the score and return -1 if no new highscore
    function isHighScore(score) {
    console.log("called");
    for (var i = 0; i < 3; i++) {
        if (localStorage.getItem(String(i)) == null) {
            return i; // No highscore yet at this position => new Highscore
        }
        else{
            var indexObject = JSON.parse(localStorage.getItem(String(i)));
            console.log(indexObject);
            if(indexObject[1] < score){ // Checking if new score is higher than currently at this index
                return i; // Returning index if new …
Run Code Online (Sandbox Code Playgroud)

javascript null local-storage

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