小编fer*_*ega的帖子

git rm --cached和'deleted'状态

我想知道为什么当我这样做:

git add <file>
Run Code Online (Sandbox Code Playgroud)

然后,我做:

git rm --cached <file>
Run Code Online (Sandbox Code Playgroud)

该文件在阶段área中保持已删除状态.

这里的例子如下: 在此输入图像描述

只是在寻找关于文件中"已删除"状态的说明.

谢谢

git msysgit

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

Visual Studio 2017 docker错误运行应用程序

我试图从visual studio 2017内部执行一个新的asp网络核心项目,但总是会出现这个错误:

构建路径不存在,不可访问或不是有效的URL

在此输入图像描述

知道问题是什么吗?

asp.net docker visual-studio-2017

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

如何使用Delphi一步初始化TList <T>?

我确信这是一个简单的问题,但我不能让它运行:

var
  FMyList: TList<String>;
begin
  FMyList := TList<String>.Create(?????);
end;
Run Code Online (Sandbox Code Playgroud)

如何插入而不是????? 插入这3个字符串:

'一'
'两'
'三'

谢谢..

delphi generics generic-list

7
推荐指数
2
解决办法
3365
查看次数

Delphi从TObjectDictionary中提取密钥

在这个问题上分享代码作为参考: Delphi TPair Exception

如何在不使用TPair的情况下从TObjectDictionary具体条目中检索键和值,并且不从列表中提取/删除/删除该对?

{$APPTYPE CONSOLE}

uses
  SysUtils,
  Generics.Defaults,
  Generics.Collections;

type
  TProduct = class
  private
    FName: string;
    procedure SetName(const Value: string);
  published
  public
    property Name: string read FName write SetName;
  end;

type
  TListOfProducts = TObjectDictionary<TProduct, Integer>;

{ TProduct }

procedure TProduct.SetName(const Value: string);
begin
  FName := Value;
end;


var
  MyDict: TListOfProducts;
  MyProduct1: TProduct;
  MyProduct2: TProduct;
  MyProduct3: TProduct;
  APair: TPair<TProduct, Integer>;
  aKey: string;

begin
  try
    MyDict := TListOfProducts.Create([doOwnsKeys]);
    MyProduct1 := TProduct.Create;
    MyProduct1.Name := 'P1';
    MyProduct2 := TProduct.Create;
    MyProduct2.Name := 'P2'; …
Run Code Online (Sandbox Code Playgroud)

delphi generics vcl delphi-xe

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

如何从git for windows获取mintty-bash的docker'对象'完成

我已阅读(并尝试过):https: //docs.docker.com/machine/completion/

但似乎这不是正确的方法.

有人知道如何在Mintty(来自Git for windows)bash命令行中获取docker completion命令吗?

shell git-bash mintty docker

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

C# 将 Func&lt;T, List&lt;myClass&gt;&gt; 数组传递给方法

我的第一篇(也是非常可怕的帖子)如下。

我尝试做一个完整的例子,我想要得到什么。我希望这能得到更好的解释。

using System;
using System.Collections.Generic;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            List<Boy> boys = new List<Boy>();
            boys.Add(new Boy("Jhon", 7));
            boys.Add(new Boy("Oscar", 6));
            boys.Add(new Boy("Oscar", 7));
            boys.Add(new Boy("Peter", 5));
            ClassRoom myClass = new ClassRoom(boys);

            Console.WriteLine(myClass.ByName("Oscar").Count);  // Prints 2
            Console.WriteLine(myClass.ByYearsOld(7).Count);  // Prints 2

            // This has errors...................
            // But this is as I would like to call my BySomeConditions method....
            Console.WriteLine(  // It should print 1
                                myClass.BySomeConditions([myClass.ByName("Oscar"),
                                                          myClass.ByYearsOld(7)]
                                                        )
                             );
            Console.ReadKey();
        }





        class ClassRoom
        {
            private …
Run Code Online (Sandbox Code Playgroud)

.net c# generics func

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

德尔福TPair例外

我有这个高峰来测试TPair.您可以在新的Delphi XE Con​​sole-app上复制+粘贴.我用例外标记了这一行:

项目Project1.exe引发异常类EAccessViolation,并在模块'Project1.exe'中显示消息'地址为0045042D的访问冲突'.读取地址A9032D0C.

任何的想法 ?

谢谢.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  Generics.Defaults,
  Generics.Collections;

type
  TProduct = class
  private
    FName: string;
    procedure SetName(const Value: string);
  published
  public
    property Name: string read FName write SetName;
  end;

type
  TListOfProducts = TObjectDictionary<TProduct, Integer>;

{ TProduct }

procedure TProduct.SetName(const Value: string);
begin
  FName := Value;
end;


var
  MyDict: TListOfProducts;
  MyProduct1: TProduct;
  MyProduct2: TProduct;
  MyProduct3: TProduct;
  APair: TPair<TProduct, Integer>;
  aKey: string;

begin
  try
    MyDict := TListOfProducts.Create([doOwnsKeys]);
    MyProduct1 := TProduct.Create;
    MyProduct1.Name := 'P1';
    MyProduct2 := …
Run Code Online (Sandbox Code Playgroud)

delphi generics exception delphi-xe

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

C#NUnit参数化TestCaseSource值标识

我在NUnit 2.6.1上使用TestCaseSource来测试具有不同对象类构造函数参数的相同Assert.

我的意思是,

[Test, TestCaseSource("myConstructorsForMale")}
public void CheckMale(Person p) 
{
     Assert.That(p.IsMale);
}

static Person[] myConstructorsForMale = 
                     {
                         new Person("John"),
                         new Person(isMale=true),
                         new Person("Doe")
                     };
Run Code Online (Sandbox Code Playgroud)

好的,一切运行正常,但这是我在NUnit控制台上收到的结果:

  • CheckMale
    • CheckMale(人)
    • CheckMale(人)
    • CheckMale(人)

所以我不知道每次迭代执行的测试是什么,如果其中任何一个失败,我就无法得到失败的测试.

我的问题是:有没有办法用注释或类似的东西来识别传递给测试的参数是什么?(在TestCaseSource属性方式中做)

谢谢.

c# nunit

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

X509Store.Certificates.Find with validOnly 为 true 不返回中间授权证书

我安装了一个证书:

  • 证书(本地计算机)
    • 受信任的根证书颁发机构
      • 证书

并且此代码使证书有效。

X509Store certStore = new X509Store(StoreName.CertificateAuthority, StoreLocation.LocalMachine);
certStore.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadOnly);

try {
    var oAuthRootCertificateList = certStore.Certificates.Find(findType, findValue, true);
    oauthRootCertificate = oAuthRootCertificateList[0];
} catch (Exception ex) {
    Trace.TraceError(ex.Message);
} finally {
    certStore.Close();
}
Run Code Online (Sandbox Code Playgroud)

* (findType 和 findValue 是之前在代码中设置的)

一切正常,代码也很好。

现在我已经从“受信任的根证书颁发机构”中删除了证书并安装在:

  • 证书(本地计算机)
    • 中级认证机构
      • 证书

因为 Azure 不允许我在受信任的根分支上部署证书。

现在,代码失败了。我必须将最后一个参数 (validOnly) 从truetofalse更改为使其运行。

您可以在此处查看该Find方法的帮助。

知道为什么它没有运行以及我如何解决它吗?

c# azure x509certificate

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

跟踪类-如何通过代码设置自动刷新

我想将AutoFlush属性设置为true,但是我需要通过代码来实现。以编程方式。

我已经找到了如何配置跟踪元素以及跟踪类的AutoFlush属性的方法。

然后,我有以下代码来获取TraceSource:

private static TraceSource GetTraceSource()
{
    var ts = new TraceSource("TraceManager")
        {
            Switch =
                {
                    Level = SourceLevels.All
                }
        };
    ts.Attributes.Add("AutoFlush", "true");
    ts.Listeners.Remove("Default");

    var file = System.IO.Path.GetTempPath() + @"\MyApplication.log";
    var textListener = new TextWriterTraceListener(file)
        {
            Filter = new EventTypeFilter(SourceLevels.All)
        };

    ts.Listeners.Add(textListener);
    return ts;
}
Run Code Online (Sandbox Code Playgroud)

如何在此代码内将AutoFlush属性设置为true?

谢谢。

c# trace system.diagnostics

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