小编Unc*_*Zen的帖子

使用RequireJS加载D3和Word云布局

尝试使用RequireJS 加载D3 v4.8和文字云布局组件(https://github.com/jasondavies/d3-cloud)时遇到问题.当D3.js和d3.layout.cloud.js都被下载到浏览器时,抛出一个异常,表明d3.layout.cloud不是一个函数.

以下是我配置RequireJS的方法:

require.config({
    waitSeconds: 10,

    baseUrl: './scripts',

    paths: {
        d3: 'd3.min',
        jquery: 'jquery-2.1.0.min',
        cloud: 'd3.layout.cloud'
    },

    shim: {


    cloud: {
        deps:['jquery', 'd3']
    }

}

});
Run Code Online (Sandbox Code Playgroud)

抛出异常的代码行是d3.layout.cloud().size([width,height]),可以在下面的函数中找到:

function wordCloud(selector) {

    var width = $(selector).width();
    var height = $(selector).height();

    //var fill = d3.scale.category20();

    //Construct the word cloud's SVG element
    var svg = d3.select(selector).append("svg")
        .attr("width", width)
        .attr("height", height)
        .append("g")
        .attr("transform", "translate("+ width/2 +","+ height/2 +")")

    var fill = d3.scale.category20();

    //Draw the word cloud
    function draw(words) {
        var cloud = …
Run Code Online (Sandbox Code Playgroud)

svg requirejs d3.js

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

使用RSA-SHA256签名方法问题签署Xml文档

我使用以下方法签署Xml文档:

public static XmlDocument SignDocument(XmlDocument doc)
    {
        string signatureCanonicalizationMethod = "http://www.w3.org/2001/10/xml-exc-c14n#";
        string signatureMethod = @"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
        string digestMethod = @"http://www.w3.org/2001/04/xmlenc#sha256";

        string signatureReferenceURI = "#_73e63a41-156d-4fda-a26c-8d79dcade713";

        CryptoConfig.AddAlgorithm(typeof(RSAPKCS1SHA256SignatureDescription), signatureMethod);

        var signingCertificate = GetCertificate();

        SignedXml signer = new SignedXml(doc);
        signer.SigningKey = signingCertificate.PrivateKey;
        signer.KeyInfo = new KeyInfo();
        signer.KeyInfo.AddClause(new KeyInfoX509Data(signingCertificate));

        signer.SignedInfo.CanonicalizationMethod = signatureCanonicalizationMethod;
        signer.SignedInfo.SignatureMethod = signatureMethod;

        XmlDsigEnvelopedSignatureTransform envelopeTransform = new XmlDsigEnvelopedSignatureTransform();
        XmlDsigExcC14NTransform cn14Transform = new XmlDsigExcC14NTransform();

        Reference signatureReference = new Reference();
        signatureReference.Uri = signatureReferenceURI;
        signatureReference.AddTransform(envelopeTransform);
        signatureReference.AddTransform(cn14Transform);
        signatureReference.DigestMethod = digestMethod;

        signer.AddReference(signatureReference);

        signer.ComputeSignature();
        XmlElement signatureElement = signer.GetXml();

        doc.DocumentElement.AppendChild(signer.GetXml());

        return …
Run Code Online (Sandbox Code Playgroud)

c# signedxml

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

IIS 7.5问题的应用程序初始化模块

作为使用IIS 7.5的应用程序初始化模块来提高Web应用程序初始化速度的概念验证的一部分,我创建了一个在IIS 7.5(Windows Server 2008 R2)上托管并启用了SSL的简单Web应用程序.请参阅下面的全球和本地设置.

如果我正确理解应用程序初始化模块的工作方式,我希望IIS向appinit.aspx(https://localhost/alwaysrunning/appinit.aspx)发出请求以初始化Web应用程序.然而,这永远不会发生.

有任何想法吗?

属性initializationPage的目的是什么?

任何有关这方面的帮助将不胜感激.

编辑:当我禁用SSL时,应用程序初始化模块按预期向appinit.aspx发出请求.我需要让它在启用SSL的情况下工作.

applicationHost.config文件中的全局设置:

<add name="appinit" autoStart="true" startMode="AlwaysRunning">
    <recycling logEventOnRecycle="Time, Requests, Schedule, Memory, IsapiUnhealthy, OnDemand, ConfigChange, PrivateMemory">
        <periodicRestart requests="0" time="00:05:00">
            <schedule>
                <clear />
            </schedule>
        </periodicRestart>
    </recycling>
    <processModel identityType="NetworkService" idleTimeout="00:00:00" />
</add>

<application path="/alwaysrunning" preloadEnabled="true" applicationPool="appinit">
    <virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\alwaysrunnig" />
</application>
Run Code Online (Sandbox Code Playgroud)

应用程序的web.config文件中的本地设置:

<applicationInitialization remapManagedRequestsTo="splashscreen.htm" skipManagedModules="true" >
    <add initializationPage="/appinit.aspx" />
</applicationInitialization> 
Run Code Online (Sandbox Code Playgroud)

ssl initialization iis-7.5

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

使用$ expand选项返回导航属性时,Web Api OData v4请求失败

对OData服务的请求类似于下面的请求按预期工作:

http:// localhost:31054/odata/Articles?$ filter = ArticleRatings/any()&$ orderby = ArticleId%20desc&$ expand = Publication&$ format = json

但是,当我将格式更改为xml时,相同的请求将失败,并显示以下错误消息:

<Error>
    <Message>An error has occurred.</Message>
    <ExceptionMessage>
        The 'ObjectContent`1' type failed to serialize the response body for content type 'application/xml; charset=utf-8'.
    </ExceptionMessage>
    <ExceptionType>System.InvalidOperationException</ExceptionType>
    <StackTrace/>
    <InnerException>
        <Message>An error has occurred.</Message>
        <ExceptionMessage>
            Object of type 'System.Linq.EnumerableQuery`1[System.Web.OData.Query.Expressions.SelectExpandBinder+SelectAllAndExpand`1[DataAccess.OData.Article]]' cannot be converted to type 'System.Collections.Generic.IEnumerable`1[DataAccess.OData.Article]'.
        </ExceptionMessage>
        <ExceptionType>System.ArgumentException</ExceptionType>
        <StackTrace>
            at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast) at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr) at System.Reflection.MethodBase.CheckArguments(Object[] parameters, …
Run Code Online (Sandbox Code Playgroud)

asp.net-web-api-odata odata-v4

7
推荐指数
0
解决办法
229
查看次数

EF 4.0/FirstOrDefault方法的奇怪行为

我正在使用EF 4.0和POCO开发一个小应用程序.

在测试我的应用程序时,我开始关注数据访问层的性能.所以我在尝试检索记录时解雇了SQL Profiler:

ctx.Orders.Include("OrderItems").FirstOrDefault<Order>(c => c.OrderID == id);
Run Code Online (Sandbox Code Playgroud)

EF发出一条SQL语句,该语句将从服务器上的Orders表中检索所有记录,并因此返回DAL,此时L2E将选择满足条件的一个并返回它.

可以改变这种行为.

谢谢!

entity-framework-4

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