小编Ben*_*bin的帖子

Angular教程中的管道和点按方法是什么?

我正在关注https://angular.io上的教程,但我找不到文档; 专门针对方法pipetap.我在https://angular.iohttp://reactivex.io/rxjs/上找不到任何内容.

我的理解是,pipetap有两种方法Observable,它正在从RxJS进口,是否正确?他们该怎么办?

我应该在哪里寻找方法的文档?

angular

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

命名MonoBehaviour类GameManager时的特殊图标

GameManagerUnity中的名称有什么特别之处会导致设计师采取不同的行动吗?我有一个名为GameManager派生的类ScriptableObject,设计师为该类与其他ScriptableObject派生类做了一些不同的事情.

我可以通过更改名称来验证此行为GameManagerManager,并统一编辑的作用是不同的.

我的定义GameManager如下:

[CreateAssetMenu(menuName = "Managers/GameManager")]
public class GameManager : ScriptableObject
{
  // ...
}
Run Code Online (Sandbox Code Playgroud)

这是我的C#类命名时Project视图的样子GameManager.注意旁边的不同图标Game Manager.

在此输入图像描述

如果我删除该资产,将基础C#类名称更改为Manager,然后再次创建资产,图标是正常图标,而不是齿轮.

在此输入图像描述

另一个问题是,如果我有一个包含MonoBehaviour具有类型属性的游戏对象,当我点击该字段旁边的小圆圈图标时GameManager,Unity将不会向我显示现有GameManager资产在检查员.Unity 允许我将GameManager资源从项目视图拖动到字段中,但Unity不会让我通过单击字段来选择引用.如下面的屏幕截图所示,Unity不会让我选择我的GameManager资产,即使它在项目视图中可用.

在此输入图像描述

在此输入图像描述

但是,如果我将底层C#类的名称从GameManager更改为Manager,则Unity编辑器可以正常工作,如下所示.

在此输入图像描述

C#类名称有什么特别之处GameManager,或者这种行为可能是由于其他原因造成的?

c# unity-game-engine

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

MSTest找不到TestAdapter.dll

我正在使用内置的Visual Studio测试工具(Test -> Run -> etc在菜单中).我刚开始遇到问题,当我尝试运行测试时出现以下错误

[3/29/2018 1:39:14 PM Error] System.IO.FileNotFoundException: C:\Users\brubin\AppData\Local\Temp\VisualStudioTestExplorerExtensions\MSTest.TestAdapter.1.1.18/build/_common/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll at Microsoft.VisualStudio.TestWindow.Controller.TestPlatformProvider.PerformShadowCopy(IEnumerable'1 testExtensions)

接下来是一些错误

Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

当我查看该文件夹时C:\Users\brubin\AppData\Local\Temp\VisualStudioTestExplorerExtensions\MSTest.TestAdapter.1.1.18/build/_common/,该文件夹中没有文件.但是,我没有故意改变我的测试设置,这几天前工作,所以我不知道它为什么会停止工作.

我的项目使用的是MSTest.TestFramework(MSTest V2)版本v1.2 NuGet包.

有一件事我注意到可能导致这个问题的是,如果我去Tools -> Extensions and Updates,我看到我的Microsoft Visual Studio测试平台几天前更新,在3/23(我认为那是我安装Visual Studio更新时).但是,如果这样做了,我不知道在哪里可以看到什么坏了,或者如何解决它.

在此输入图像描述

mstest visual-studio visual-studio-2017

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

XDebug 断点在 Visual Studio Code 中给出 PHP 错误

我正在尝试使用 XDebug 和 Visual Studio Code 在 PHP 代码中设置断点,这些代码都安装在 Ubuntu Hyper-V 虚拟机上。我使用的是 PHP 7.2。

每当我在 PHP 代码中设置断点并刷新应该命中断点的页面时,我都会收到错误“命令不可用”和“没有这样的断点”显示在 Visual Studio 代码的弹出窗口中。我还在调试控制台中收到以下错误。

XDebugError: command is not available
    at new Response (/home/ben/.vscode/extensions/felixfbecker.php-debug- 
1.13.0/out/xdebugConnection.js:56:19)
    at new BreakpointSetResponse (/home/ben/.vscode/extensions/felixfbecker.php-debug- 
1.13.0/out/xdebugConnection.js:207:9)
    at Connection.<anonymous> (/home/ben/.vscode/extensions/felixfbecker.php-debug 
1.13.0/out/xdebugConnection.js:599:20)
    at Generator.next (<anonymous>)
    at fulfilled (/home/ben/.vscode/extensions/felixfbecker.php-debug-1.13.0/out/xdebugConnection.js:4:58) {
  code: 5,
  name: 'XDebugError'
}
Run Code Online (Sandbox Code Playgroud)

根据我的研究,我认为问题在于 XDebug 不适用于 IPv6,但调试器正在侦听 v6。如果我这样做netstat -an | grep 9000,我得到

tcp6       0      0 :::9000                 :::*                    LISTEN  
Run Code Online (Sandbox Code Playgroud)

以下是内容 /etc/php/7.2/fpm/conf.d/20-xdebug.ini

zend_extension=xdebug.so
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.var_display_max_depth=-1
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1 …
Run Code Online (Sandbox Code Playgroud)

php xdebug visual-studio-code

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

从 Visual Studio 推送 Git 存储库时运行 ssh.exe 时出错

我可以在命令行中使用 Git 推送到 Github,没有任何问题。现在我正在尝试使用 Visual Studio 2019 推送到 Github。我在 Visual Studio 中打开“Git”>“管理分支”窗口,然后单击当前提交上的“推送”链接。我收到以下错误:

Opening repositories:
C:\Users\brubin\source\repos\MyRepo
Commit 6da600da created locally in repository C:\Users\brubin\source\repos\MyRepo
Pushing master
Pushing to github.com:MyUser/MyRepo.git
Error: cannot spawn C:/WINDOWS/System32/OpenSSH/ssh.exe: No such file or directory
Error encountered while pushing to the remote repository: Git failed with a fatal error.
unable to fork

Failed to push to the remote repository. See the Output window for more details.
Run Code Online (Sandbox Code Playgroud)

ssh.exe 确实存在于该路径上。我也尝试过以管理员身份运行 Visual Studio。

在此输入图像描述

git visual-studio visual-studio-2019

8
推荐指数
2
解决办法
5123
查看次数

Unity中的多个Visual Studio项目

我试图将我的所有非Unity特定代码移动到不继承的类中MonoBehaviour,类似于.我Models为所有非MonoBehaviour类创建了一个单独的Visual Studio项目,并将该项目添加到Visual Studio解决方案中.但是,我无法Models通过Visual Studio向我的Unity项目添加对项目的引用(当我单击Unity项目时,Add Reference按钮不存在,我已经读过Unity无论如何都会自动重建它的Visual Studio项目,所以任何添加的引用都会丢失),所以我将Models.dll 的输出位置设置为Unity中的Assets文件夹,然后我将.dll添加到Unity的Project视图中.这一切都奏效了.问题是每当我重建我的Models项目时,Visual Studio中的Unity项目似乎都没有获取更改,所以我必须从Unity的Project视图中删除.dll并在每次我做任何时重新添加它.对Models项目的更改.

有没有办法让Visual Studio自动查看我的Models.dll 的更改,还是有更好的方法让我的Unity项目引用另一个Visual Studio项目?

unity-game-engine unity5

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

可以使用 FileZilla 或 WinSCP 连接到 FTP,但不能使用 FtpWebRequest 或 FluentFTP 连接到 FTP

我正在尝试在代码中通过 SSL 打开 FTP 连接。我可以使用 WinSCP 的 FileZilla 连接并列出目录。但是当使用 .NET 代码列出目录时FtpWebClient,我收到错误

(425) 无法打开数据连接

由于我能够从同一台计算机使用 FileZilla 进行连接,因此我不确定如何解决此问题。

这是我的代码

public void FtpStuff()
{
   string url = "ftp://my.server.com";

   FtpWebRequest request = (FtpWebRequest)WebRequest.Create(url);
   request.Credentials = new NetworkCredential("myname", "password");
   request.EnableSsl = true;
   request.Method = WebRequestMethods.Ftp.ListDirectory;
   FtpWebResponse response = (FtpWebResponse)request.GetResponse();
   StreamReader streamReader = new StreamReader(response.GetResponseStream());

   // This is the line that throws the exception
   string line = streamReader.ReadLine();
}
Run Code Online (Sandbox Code Playgroud)

我也尝试过FluentFTP。这是我的代码。我得到了例外

无法建立数据连接:不允许操作。

public void FtpStuff()
{
   FtpClient client = new FtpClient();
   client.Host = "my.server.com";
   client.Credentials …
Run Code Online (Sandbox Code Playgroud)

c# ftp ssl ftpwebrequest fluentftp

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

为什么该决策树每一步的值之和不等于样本数?

我正在阅读有关决策树和装袋分类器的内容,并且我试图展示装袋分类器中使用的第一个决策树。我对输出感到困惑。

from sklearn.model_selection import train_test_split
from sklearn.datasets import make_moons
from sklearn.ensemble import BaggingClassifier
from sklearn import tree
from sklearn.tree import DecisionTreeClassifier
from sklearn.tree import export_graphviz
from graphviz import Source

X, y = make_moons(n_samples=500, noise=0.30, random_state=42)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)

bag_clf = BaggingClassifier(
    DecisionTreeClassifier(), 
    n_estimators=500,
    max_samples=100, 
    bootstrap=True, 
    n_jobs=-1)
bag_clf.fit(X_train, y_train)

Source(tree.export_graphviz(bag_clf.estimators_[0], out_file=None))
Run Code Online (Sandbox Code Playgroud)

这是输出的一个片段

在此输入图像描述

据我了解,value应该显示有多少样本被分类为每个类别。那么,value字段中的数字不应该加到字段中吗samples?为什么这里的情况不是这样呢?

python machine-learning decision-tree scikit-learn

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

如何对 Pandas 数据框进行二分搜索以获取列值的组合?

对不起,如果这是熊猫文档解释的一个简单问题,但我已经尝试寻找如何做到这一点并且没有任何运气。

我有一个包含多列的 Pandas datafame,我希望能够使用二分搜索搜索特定行,因为我的数据集很大,我将进行大量搜索。

我的数据如下所示:

Name           Course   Week  Grade
-------------  -------  ----  -----
Homer Simpson  MATH001  1     97
Homer Simpson  MATH001  3     85
Homer Simpson  CSCI100  1     89
John McGuirk   MATH001  2     78
John McGuirk   CSCI100  1     100
John McGuirk   CSCI100  2     96
Run Code Online (Sandbox Code Playgroud)

我希望能够快速搜索我的数据以查找名称、课程和周的特定组合。名称、课程和周的每个不同组合在数据集中都有零或一行。如果我正在搜索的名称、课程和周的组合缺少值,我希望我的搜索返回 0。

例如,我想搜索值 (John McGuirk, CSCI100, 1)

有没有内置的方法来做到这一点,还是我必须编写自己的二进制搜索?

更新:

我尝试使用下面一位评论者建议的内置方式执行此操作,我还尝试使用为我的特定数据编写的自定义二进制搜索和另一个使用递归处理不同列的自定义二进制搜索来执行此操作比我的具体例子。

这些测试的数据框包含 10,000 行。我把时间放在下面。两种二分搜索都比[...]用于获取行的性能更好。我远非 Python 专家,所以我不确定我的代码优化得如何。

# Load data
from pandas import DataFrame, read_csv
import math
import pandas as pd
import time

file = 'grades.xlsx'
df …
Run Code Online (Sandbox Code Playgroud)

python numpy pandas

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

为什么对象的所有属性没有显示在调试器的变量部分中

我在某些 PHP 代码上使用 XDebug 和 Visual Studio Code 调试器,并且变量部分没有显示我的对象之一的所有属性。下面的屏幕截图显示,如果我添加$this->_data到“监视”部分,该属性确实存在。但是,在“变量”部分中_data并未显示为属性。$this为什么 Visual Studio Code 不显示 中的所有属性$this,以及如何让它显示所有属性?

在此输入图像描述

php xdebug visual-studio-code vscode-debugger

5
推荐指数
2
解决办法
1439
查看次数