问题列表 - 第237484页

通过routerLink定位命名插座会增加无关的"/"

我正试图通过路由在我的应用程序中启动模式.一切似乎都有效,除了向URL添加额外的斜杠以防止它解析.Url应该看起来像这样(如果我手动输入它会起作用)......

/accounts(modal:accounts/1/edit)
Run Code Online (Sandbox Code Playgroud)

但我得到了这个(注意基本网址和出口目标之间的斜线)......

/accounts/(modal:accounts/1/edit)
Run Code Online (Sandbox Code Playgroud)

基本标签已设置...

<head>
  <meta charset="utf-8">
  <title>myApp</title>
  <base href="/">
  ...
</head>
Run Code Online (Sandbox Code Playgroud)

这是我的路由配置(accounts-routing.module.ts)

const ACCOUNT_ROUTES: Routes = [
  {
    path: 'accounts',
    component: AccountsIndexComponent
  },{
    path: 'accounts/new',
    component: AccountsNewComponent
  },{
    path: 'accounts/:id',
    component: AccountsShowComponent
  },{
    path: 'accounts/:id/edit',
    component: AccountsEditComponent,
    outlet: 'modal'
  }
];
Run Code Online (Sandbox Code Playgroud)

和插座(app.component.html)

<router-outlet></router-outlet>
<router-outlet name="modal"></router-outlet>
Run Code Online (Sandbox Code Playgroud)

和链接......

<a [routerLink]="[{ outlets: { modal: ['accounts', account.id, 'edit'] } }]">Edit</a>
Run Code Online (Sandbox Code Playgroud)

我错过了什么?该项目是利用创建angular-cli@1.0.0-beta.26angular@2.4.6angular-router@3.4.6安装.

FWIW,这是日志的截图...

路由尝试失败

router modal-dialog outlet angular2-routing angular

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

SpaCy:如何加载Google新闻word2vec向量?

我尝试了几种加载google news word2vec向量的方法(https://code.google.com/archive/p/word2vec/):

en_nlp = spacy.load('en',vector=False)
en_nlp.vocab.load_vectors_from_bin_loc('GoogleNews-vectors-negative300.bin')
Run Code Online (Sandbox Code Playgroud)

以上给出:

MemoryError: Error assigning 18446744072820359357 bytes
Run Code Online (Sandbox Code Playgroud)

我也试过.gz打包向量; 或者使用gensim将它们加载并保存为新格式:

from gensim.models.word2vec import Word2Vec
model = Word2Vec.load_word2vec_format('GoogleNews-vectors-negative300.bin', binary=True)
model.save_word2vec_format('googlenews2.txt')
Run Code Online (Sandbox Code Playgroud)

然后,该文件包含每行上的单词及其单词向量.我试着加载它们:

en_nlp.vocab.load_vectors('googlenews2.txt')
Run Code Online (Sandbox Code Playgroud)

但它返回"0".

这样做的正确方法是什么?

更新:

我可以将自己创建的文件加载到spacy中.我在每一行使用带有"string 0.0 0.0 ...."的test.txt文件.然后使用.bzip2将此txt压缩到test.txt.bz2.然后我创建一个spacy兼容的二进制文件:

spacy.vocab.write_binary_vectors('test.txt.bz2', 'test.bin')
Run Code Online (Sandbox Code Playgroud)

我可以加载到spacy:

nlp.vocab.load_vectors_from_bin_loc('test.bin')
Run Code Online (Sandbox Code Playgroud)

这有效!但是,当我为googlenews2.txt执行相同的过程时,我收到以下错误:

lib/python3.6/site-packages/spacy/cfile.pyx in spacy.cfile.CFile.read_into (spacy/cfile.cpp:1279)()

OSError: 
Run Code Online (Sandbox Code Playgroud)

python nlp word2vec spacy

19
推荐指数
2
解决办法
9117
查看次数

在Visual Studio代码中更改代码段位置

我正在使用visual studio代码,需要将用户代码段放在我的项目存储库中.如何将片段文件的位置更改为自定义文件?我在Windows 10上工作.

code-snippets visual-studio-code

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

为什么QsslSocket在Qt 5.3上使用而不是在Debian Stretch上使用Qt 5.7?

我有一个使用QWebSocket类但不使用SSL 的应用程序.当我执行使用Qt 5.3编译的版本但Qt 5.7可执行文件冻结以下警告时,它工作正常:

QSslSocket: cannot resolve CRYPTO_num_locks
QSslSocket: cannot resolve CRYPTO_set_id_callback
QSslSocket: cannot resolve CRYPTO_set_locking_callback
QSslSocket: cannot resolve ERR_free_strings
QSslSocket: cannot resolve EVP_CIPHER_CTX_cleanup
QSslSocket: cannot resolve EVP_CIPHER_CTX_init
QSslSocket: cannot resolve sk_new_null
QSslSocket: cannot resolve sk_push
QSslSocket: cannot resolve sk_free
QSslSocket: cannot resolve sk_num
QSslSocket: cannot resolve sk_pop_free
QSslSocket: cannot resolve sk_value
QSslSocket: cannot resolve SSL_library_init
QSslSocket: cannot resolve SSL_load_error_strings
QSslSocket: cannot resolve SSL_get_ex_new_index
QSslSocket: cannot resolve SSLv2_client_method
QSslSocket: cannot resolve SSLv3_client_method
QSslSocket: cannot resolve SSLv23_client_method
QSslSocket: cannot …
Run Code Online (Sandbox Code Playgroud)

ssl debian qt

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

如何在没有 git 的情况下设置rapidjson

我需要使用rapidjson作为第三方库来替换libjson。我正在尝试弄清楚如何构建它,以便我可以在我的项目(依赖项列表)中使用它的构建文件。

\n\n

我从 github 下载了rapidjson,并且正在尝试获得一个可构建的项目。我正在查看rapidjson网站上的说明,它显示我需要执行以下操作(安装)。

\n\n
    \n
  1. 我们不使用 git,那么我需要做什么来代替 git submodule update --init 步骤呢?

  2. \n
  3. 为什么我需要在 include/rapidjson 目录中创建一个没有任何内容的构建目录?

  4. \n
  5. 当我 cd 构建并输入 cmake 时,似乎缺少参数。完整的 cmake 命令是什么?谢谢!

  6. \n
\n\n

安装

\n\n

RapidJSON 是一个仅包含头文件的 C++ 库。只需将 include/rapidjson 文件夹复制到系统或项目的包含路径即可。

\n\n

RapidJSON 使用以下软件作为其依赖项:\n\xe2\x80\xa2CMake 作为通用构建工具\n\xe2\x80\xa2(可选)Doxygen 构建文档\n\xe2\x80\xa2(可选)单元的 googletest和性能测试

\n\n

要生成用户文档并运行测试,请继续执行以下步骤:\n1.执行 git submodule update --init 以获取第三方子模块的文件(google test)。\n2.在rapidjson源目录中创建名为 build 的目录。\n3 .更改到构建目录并运行 cmake .. 命令来配置您的构建。Windows 用户可以使用 cmake-gui 应用程序执行相同的操作。\n4.在 Windows 上,构建在构建目录中找到的解决方案。在 Linux 上,从构建目录运行 make。

\n\n

成功构建后,您将在 bin 目录中找到编译的测试和示例二进制文件。生成的文档将在构建树的 doc/html 目录中提供。要在完成构建后运行测试,请从构建树运行 make test 或 ctest。您可以使用 ctest -V 命令获得详细的输出。

\n\n …

linux installation rapidjson

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

VBA代码返回#value错误

我正在尝试显示excel中条件格式的颜色.在excel中我只使用= CheckColour(B5),当我点击返回时它可以工作.但是,当我要求工作表计算时,函数给出#VALUE!而且我不知道我哪里出错了.任何帮助都表示赞赏,因为我是VBA的初学者.谢谢

    Function CheckColour(range)
        If range.DisplayFormat.Interior.Color = RGB(255, 0, 0) Then
        CheckColour = "Red"
        ElseIf range.DisplayFormat.Interior.Color = RGB(0, 130, 59) Then
        CheckColour = "Green"
        Else
        CheckColour = "Amber"
        End If
    End Function
Run Code Online (Sandbox Code Playgroud)

excel vba excel-vba

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

如何禁用 iOS Google 移动广告 SDK 控制台日志?

每当 Google 发布新版本的 Google 移动广告 SDK 时,当前版本都会向控制台发送以下垃圾邮件:

<Google:HTML> You are currently using version x.y.z of the SDK. Please consider 
updating your SDK to the most recent SDK version to get the latest features and 
bug fixes. The latest SDK can be downloaded from ****. 
A full list of release notes is available at https://developers.google.com/admob/ios/rel-notes.
Run Code Online (Sandbox Code Playgroud)

每个广告加载都会多次输出这些内容,如果您实际上正在尝试调试应用程序并在具有不同广告的不同屏幕上移动,那么控制台就会一团糟。

这无疑是保持 SDK 更新的巨大动力,但有时我想调试优先级列表中更高的其他问题。

logging admob ios

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

具有通用特征的结构,这也是通用特征

在 Rust 1.15 中,我创建了一个特征来抽象读取和解析文件格式。我正在尝试创建一个内部具有此通用特征的结构。

我有这个特点:

use std::io::Read;

trait MyReader<R: Read> {
    fn new(R) -> Self;
    fn into_inner(self) -> R;

    fn get_next(&mut self) -> Option<u32>;
    fn do_thingie(&mut self);
}
Run Code Online (Sandbox Code Playgroud)

我想创建一个结构,它引用了实现这个的东西。

struct MyIterThing<'a, T: MyReader<R>+'a> {
    inner: &'a mut T,
}
Run Code Online (Sandbox Code Playgroud)

给出以下错误:

use std::io::Read;

trait MyReader<R: Read> {
    fn new(R) -> Self;
    fn into_inner(self) -> R;

    fn get_next(&mut self) -> Option<u32>;
    fn do_thingie(&mut self);
}
Run Code Online (Sandbox Code Playgroud)

T: MyReader+'a, 我收到错误: "error[E0243]: wrong number of type arguments: expected 1, found 0",T: MyReader<R: …

traits rust

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

PHP没有从上一页的表单中获得任何响应

我有文件"1.p​​hp"和文件"2.php"...

在"1.php"中,有一个HTML表单:

<form action="2.php" method="post">
  <div class="form-group">
    <label for="db_username">Field 1:</label>
    <input type="text" class="form-control" id="db_username">
  </div>
  <div class="form-group">
    <label for="db_password">Field 2:</label>
    <input type="password" class="form-control" id="db_password">
  </div>
  <div class="form-group">
    <label for="db_passphrase">Field 3:</label>
    <input type="text" class="form-control" id="db_passphrase">
  </div>
  <button type="submit" class="btn btn-default">Next</button>
</form>
Run Code Online (Sandbox Code Playgroud)

在"2.php"中,动作必须在PHP中应用..就像:

<?php
// Process of Step "1"
$db_username = $_POST['db_username'];
$db_password = $_POST['db_password'];
$db_passphrase = $_POST['db_passphrase'];

if( !isset($db_username) || !isset($db_password) || !isset($db_passphrase) ) {
    header("Location: 1.php?error=1");
    die();
}
?>
Run Code Online (Sandbox Code Playgroud)

然而..的值$_POST['db_username'],$_POST['db_password']并且$_POST['db_passphrase']是空的...

html php

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

如何求和

我正在尝试获得“总覆盖”,但仅在代理 = x、y 或 z 时求和

SELECT   
    DISTINCT( "public"."rdf_dean"."agent_name" )  AS "Agent",
    SUM("public"."rdf_dean"."paidcomm" *.9) AS "Paid to Agent",
    SUM("public"."rdf_dean"."paidcomm" *.1) AS "Overrides",
    SUM overrides IF agent_name = x OR agent_name = y OR agent_name = z

FROM     "public"."rdf_dean"
WHERE "public"."rdf_dean"."created_date" = date(now())
GROUP BY agent_name
Run Code Online (Sandbox Code Playgroud)

postgresql sum

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