小编aro*_*eer的帖子

Bower安装仅使用https?

我正在尝试在我们组织的数据中心的构建服务器上设置Bower,但是git端口似乎没有在数据中心的防火墙上打开.我可以使用git命令行客户端来克隆https://[repo],但不是git://[repo].

是否有一个开关或首选项将指示bower使用https而不是git协议执行git clone ?

我看过的来源,并认为更改分辨率代码替换git://https://,但我想我会问之前,我去那些长度.

git git-clone bower

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

.NET中的对象引用有多大?

.NET中对象引用的大小是多少?它是否在x86,x64和/或AnyCPU编译之间有所不同?

如果它有所作为,我个人对C#感兴趣.

.net c# reference

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

有没有理由为自己设置例外原因?

我遇到过我正在构建的java库中的一些地方,其中异常的原因被设置为异常本身.

是否有任何理由将异常引用为其原因?

编辑

根据要求,这是一个具体的例子:

在此输入图像描述

java exception

12
推荐指数
3
解决办法
2693
查看次数

为什么guava的Cache.invalidate(Object key)方法不通用?

来自javadocs:

public interface Cache<K,V> extends Function<K,V> {
    //...
    void invalidate(Object key);
    //...
}
Run Code Online (Sandbox Code Playgroud)

为什么不将其呈现为通用方法:

    void invalidate(K key);
Run Code Online (Sandbox Code Playgroud)

有技术原因,历史原因还是其他原因?

java caching guava

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

Resharper不会自动转换为Serializable类中的自动属性 ​​- 我应该吗?

我今天遇到了这个问题,并且能够确定在进行代码清理时,R#不会将属性从支持字段转换为使用SerializableAttribute修饰的类中的自动属性,例如

using System; 

namespace DataContracts
{
    [Serializable]
    public class Class1
    {
        private bool _wontChange;

        public bool WontChange
        {
            get { return _wontChange; }
            set { _wontChange = value; }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

在自动代码清理期间,不会更改上述代码.当然,我可以手动执行此操作,我仍然可以从R#获取快速操作菜单选项,以便在单个属性级别执行此操作.但它让我想知道在[Serializable]类中使用自动属性是否存在我不知道的潜在问题.

JetBrains论坛帖子中,我们提到了一个讨论这个问题的问题,但似乎没有明确解决.

c# resharper automatic-properties serializable

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

为什么不在用作泛型类型参数的类上调用静态构造函数?

鉴于以下课程:

public class Foo {
    static Foo() {
        Console.WriteLine("Foo is being constructed");
    }
}

public class Bar {
    public void ReferenceFooAsGenericTypeParameter<T>() {
        Console.WriteLine("Foo is being referenced as a generic type parameter");
    }
}

public class SampleClass
{
    public static void Main()
    {
        new Bar().ReferenceFooAsGenericTypeParameter<Foo>();
    }
}
Run Code Online (Sandbox Code Playgroud)

输出是

Foo is being referenced as a generic type parameter

根据规范,这是有道理的:

在创建第一个实例或引用任何静态成员之前,会自动调用静态构造函数来初始化类.

但我很好奇为什么在将类型作为泛型类型参数引用时不调用静态构造函数.

c# generics static-constructor

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

Mono 3.0.0基于CentOS 6构建

我最近发现自己需要为CentOS 6构建Mono 3.0,我的基础设施人员要求尽可能保持系统尽可能靠近CentOS(如果可能的话,没有第三方软件包).

因为目前没有我能找到的Mono 3.0 RPM,所以我在一个干净的Minimal安装的CentOS 6.3上进行了从头开始构建它的练习.

可以在CentOS 6.3上构建没有外部软件包的Mono 3.0.

mono centos build rhel centos6

11
推荐指数
2
解决办法
9224
查看次数

WCF服务通过https而不是http返回404

我正在将现有服务从HTTP(Dev/UAT)迁移到HTTPS(生产),我遇到配置问题.这是我的web.config的system.serviceModel部分:

<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="false" />
    <services>
      <service name="MyService">
        <endpoint name="MyEndpoint" address="" binding="wsHttpBinding"
            bindingConfiguration="secureBinding" contract="IMyService" />
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="secureBinding">
          <security mode="Transport"></security>
        </binding>
      </wsHttpBinding>
    </bindings>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

我已经试过这同时使用basicHttpBindingwsHttpBinding,与相同的结果:

  • 我可以使用我的SOAP客户端调用该服务 http://server.domain.com/MyService.svc
  • 我可以使用浏览器来点击该服务 https://server.domain.com/MyService.svc
  • 我不能使用https://server.domain.com/MyService.svc- 我的SOAP客户端调用服务- 调用总是错误404: not found.

我的https站点使用由公司域上的CA颁发的证书进行了认证,并且我已经验证我已在Trusted Root Certification Authorities我正在进行呼叫的系统上安装了CA的证书.

相关客户代码:

Service service = new Service();
service.Url = "http://server.domain.com/MyService.svc";
//service.Url = "https://server.domain.com/MyService.svc";
service.WebMethodCall();
Run Code Online (Sandbox Code Playgroud)

编辑

以下是WSDL的请求部分:

<wsdl:types/> …
Run Code Online (Sandbox Code Playgroud)

https wcf soap

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

是否有一个CSS选择器可以选择带有溢出文本的元素?

是否可以编写一个只选择调用了文本溢出行为的元素的css选择器?

<div style="width: 200px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
I don't want to select this
</div>

<div style="width: 200px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
But I do want to select this because it's overflowing
</div>
Run Code Online (Sandbox Code Playgroud)

小提琴

css css-selectors css3

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

XmlReader在UTF-8 BOM上中断

我的应用程序中有以下XML解析代码:

    public static XElement Parse(string xml, string xsdFilename)
    {
        var readerSettings = new XmlReaderSettings
        {
            ValidationType = ValidationType.Schema,
            Schemas = new XmlSchemaSet()
        };
        readerSettings.Schemas.Add(null, xsdFilename);
        readerSettings.ValidationFlags |= XmlSchemaValidationFlags.ProcessInlineSchema;
        readerSettings.ValidationFlags |= XmlSchemaValidationFlags.ProcessSchemaLocation;
        readerSettings.ValidationFlags |= XmlSchemaValidationFlags.ReportValidationWarnings;
        readerSettings.ValidationEventHandler +=
            (o, e) => { throw new Exception("The provided XML does not validate against the request's schema."); };

        var readerContext = new XmlParserContext(null, null, null, XmlSpace.Default, Encoding.UTF8);

        return XElement.Load(XmlReader.Create(new StringReader(xml), readerSettings, readerContext));
    }
Run Code Online (Sandbox Code Playgroud)

我用它来解析发送到我的WCF服务的字符串到XML文档,用于自定义反序列化.

当我读入文件并通过网络发送它们时(请求),它工作正常; 我已经确认没有发送BOM.在我的请求处理程序中,我正在序列化响应对象并将其作为字符串发送回来.序列化过程将UTF-8 BOM添加到字符串的前面,这会导致在解析响应时中断相同的代码.

System.Xml.XmlException : Data at the root level is …
Run Code Online (Sandbox Code Playgroud)

c# byte-order-mark xmlreader utf-8

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