问题列表 - 第251785页

对 Node 库使用“导入”,而不是“需要”?

新手节点问题在这里。

我正在尝试将Google Cloud Node 客户端与现有应用程序(不是我编写的)一起使用,该应用程序将其代码与汇总捆绑在一起。

我已经尝试使用 require 导入库,根据其文档,如下所示:

 import REGL from "regl/dist/regl";
 import Camera from "./lib/camera";
 ...
 var gcloud = require('google-cloud');
Run Code Online (Sandbox Code Playgroud)

但是我的应用程序抱怨(澄清:它只在我添加require语句时才开始产生这个错误,否则导入工作正常):

'import' and 'export' may only appear at the top level
Run Code Online (Sandbox Code Playgroud)

所以也许我需要使用import gcloud而不是require,但是如何使用?我尝试查看代码node_modules并改为执行此操作:

import gcloud from "google-cloud/src/index";
Run Code Online (Sandbox Code Playgroud)

但是现在我遇到了一堆其他错误

   Unexpected token
node_modules/google-cloud/node_modules/ent/reversed.json (2:7)
1: {
2:     "9": "Tab;",
      ^
Run Code Online (Sandbox Code Playgroud)

我怎样才能使用import而不是require,或者,我怎样才能require很好地玩import

javascript node.js

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

StyleCop设置不会出现在Visual Studio中

我安装了StyleCop NuGet包,现在我想更改几个设置StyleCop,但右键单击解决方案菜单不会出现StyleCop Settings阻塞..

有任何想法吗?

c# stylecop nuget visual-studio-2017

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

图像处理如何检测相机前的照片或真人?

我计划开发一个软件,可以通过面部识别作为我的最后一年项目(FYP)。 (只是一个想法)

我在网上搜索了有关图像处理库的信息,我发现OpenCv它更为人所知,因为我OpenCv在 youtube 上发现了很多用于人脸识别的视频,这肯定会对我有很大帮助。(我对图像处理完全陌生) . 此外,我将使用 Visual Studio。

第一个问题来了,是否有可能在拍摄时检测到它是照片还是真人站在相机前?

如果是,您能否为我提供一些有关图像处理如何检测“照片”和“真人”的链接或教程链接?

正如我所说,我对图像处理完全陌生,这只是我 FYP 的一个想法

或者是您推荐的任何开源库?

opencv image-processing

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

Maven 项目依赖项“找不到工件”

我有 2 个 Maven 项目。项目 A 和项目 B。项目 B 依赖于项目 A,但反之则不然。

在我的项目 B pom 中我有这个:

    <dependency>
        <groupId>com</groupId>
        <artifactId>ProjectA</artifactId>
        <type>pom</type>
        <version>1.0-SNAPSHOT</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

当我尝试打包项目时,它失败并出现以下错误:

 [ERROR] Failed to execute goal on project ProjectB: Could not resolve    dependencies for project com:ProjectB:war:1.0-SNAPSHOT: Could not find  artifact com:ProjectA:pom:1.0-SNAPSHOT -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project ProjectB: Could not resolve dependencies for project com:ProjectB:war:1.0-SNAPSHOT: Could not find artifact com:ProjectA:pom:1.0-SNAPSHOT
Run Code Online (Sandbox Code Playgroud)

所以它找不到我的ProjectA pom。我需要将它放入我的项目中吗?它应该位于我的文件结构中的什么位置。

就其价值而言,我正在使用 intelliJ IDE。

提前致谢。

编辑:当我在projectA上运行安装时,出现此错误:

The packaging for this project did not assign …
Run Code Online (Sandbox Code Playgroud)

intellij-idea pom.xml maven

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

在Vim中,如何仅在当前行中搜索和替换?

我看到如何在特定行中搜索和替换,按行号指定,以及如何使用当前行作为对多行向下的引用进行搜索和替换.

如何仅在当前行中搜索和替换?我正在寻找一个简单的解决方案,不涉及链接解决方案指定行号.

vim replace

14
推荐指数
4
解决办法
9227
查看次数

带有多个列表的 C# List.OrderBy

我有 5 个列表。一个包含发布日期,其他是该列表的属性,但在多个列表中分开。

List<string> sortedDateList = x1.OrderBy(x => x).ToList();

这段代码首先按照最旧的日期对列表进行排序,就像它应该的那样。但我也想对其他属性列表进行排序(同步),因为它们需要与日期相同的索引。

我怎么能意识到这一点?我是 Linq 方法的新手。

c# linq list

0
推荐指数
2
解决办法
1415
查看次数

在.net core 2.0中缓存声明

到处都抬头,但看起来我现在被困住了。我在应用程序中使用Windows Active Directory进行身份验证。为了获得授权,我使用索赔。在搜索了有限的.net核心文档之后,这就是我的代码的样子。

启动文件

public void ConfigureServices(IServiceCollection services)
    {
        services.AddTransient<IPrincipal>(
            provider => provider.GetService<IHttpContextAccessor>().HttpContext.User);
        services.AddTransient<IClaimsTransformation, ClaimsTransformer>();
        services.AddAuthentication(IISDefaults.AuthenticationScheme);

    }
Run Code Online (Sandbox Code Playgroud)

ClaimsTransformer.cs

class ClaimsTransformer : IClaimsTransformation
{
   public Task<ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
   {

// call to database to get more claims based on user id ClaimsIdentity.Name
     ((ClaimsIdentity)principal.Identity).AddClaim(new Claim("now",DateTime.Now.ToString()));
     return Task.FromResult(principal);
   }
}
Run Code Online (Sandbox Code Playgroud)

但是问题是,每次请求都会调用此代码,并且每次都会从db加载声明,这是绝对错误的。有什么办法可以缓存它?我能够创建声明的cookie并将该cookie用于.net 4.0中的任何其他调用。我似乎找不到核心的方法。我检查的所有文档都不完整,或者不涵盖我的情况。我可以在应用程序中进一步声明文档在这里的说法:https : //docs.microsoft.com/zh-cn/aspnet/core/security/authorization/claims

但是没有提到有关缓存索赔的内容。

有人在同一条船上吗?还是知道出路?

.net c# asp.net claims-based-identity asp.net-core

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

在 Centos 上安装 R 'sf' 包 -- gdal 共享库错误

如何'sf'在 CentOS 上安装 R包?在尝试安装时,由于 gdal 软件包过时,我最初遇到错误;我更新了 gdal(从以下源代码构建:http : //trac.osgeo.org/gdal/wiki/BuildingOnUnix),现在出现错误:

 checking GDAL: linking with --libs only... yes
 checking GDAL: /usr/local/share/gdal/pcs.csv readable... yes
 checking GDAL: checking whether PROJ.4 is available for linking:... yes
 checking GDAL: checking whether PROJ.4 is available fur running:... 
 ./gdal_proj: error while loading shared libraries: libgdal.so.20: cannot open 
 shared object file: No such file or directory
  no
 configure: error: OGRCoordinateTransformation() does not return a 
coord.trans: 
 PROJ.4 not available?
ERROR: configuration failed for package ‘sf’
Run Code Online (Sandbox Code Playgroud)

我试过创建一个到 …

linux r

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

如何使用重置按钮从 bootstrap-multiselect 中取消选择所有选定的值?

I am having issues when trying to select the element which contains all the selected values.

For example: if you select by id such as 
Run Code Online (Sandbox Code Playgroud)

$('#campaign-select').multiselect('refresh'),

它没有做任何事情。这是为什么?

请参阅jsFiddle

修复!

$('#filter-reset-btn').on('click', function () {

               $('#campaigns-select').multiselect('rebuild');
               /* resetting the select element to refresh*/
               $('#campaigns-select,#sites-select,#mdmadservers-select,#ratetypes-select option:selected').each(function () {

                   $(this).prop('selected', false);

               })

               $('#campaigns-select,#sites-select,#mdmadservers-select,#ratetypes-select').val([]).multiselect('refresh')



           });
Run Code Online (Sandbox Code Playgroud)

这里更新为jsFiddle

javascript jquery twitter-bootstrap bootstrap-multiselect

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

v-如果不在模板标签上工作

根据Vue文档,我应该能够将v-if条件添加到<template>标记:

<template v-if="false">
  <div>Invisible text</div>
</template>
Run Code Online (Sandbox Code Playgroud)

但是这不会隐藏元素,但是当它添加到子元素时它确实有效:

<template>
  <div v-if="false">Invisible text</div>
</template>
Run Code Online (Sandbox Code Playgroud)

有什么建议?

我将模板包含在另一个.vue文件中:

<template>
  <div id="app">
    <H1 class= "main-title">Title</H1>
    <span class="components">
      <testtemplate></testtemplate>
    </span>
  </div>
</template>
Run Code Online (Sandbox Code Playgroud)

vue.js

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