小编Sig*_*dur的帖子

从 GitHub 导入到 Azure DevOps 时“克隆 URL 不正确”

我尝试将 GitHub 存储库导入到 Azure DevOps,但不断收到此错误:

Import request cannot be processed due to one of the following reasons:

Clone URL is incorrect.
Clone URL requires authorization.
Run Code Online (Sandbox Code Playgroud)

这是我的输入参数的截图: 导入错误及输入参数

我对克隆 URL 和身份验证参数进行了两次和三次检查。无论我在字段中输入什么,它总是显示这两个错误。我该如何解决这个问题?

import github repository azure-devops

29
推荐指数
4
解决办法
2万
查看次数

Weka 抛出“UnassignedDatasetException”

我正在使用 Weka 3.6.11,但遇到了一个错误,我无法弄清楚是什么导致了它。我遵循了 Weka 手册中的第 202-204 页,并像他们说的那样构建了我的数据。仍然当我尝试对数据进行分类时,我得到了一个错误。

weka.core.UnassignedDatasetException: Instance doesn't have access to a dataset!
Run Code Online (Sandbox Code Playgroud)

这是我到目前为止的代码:

public static void classifyTest()
    {
        try
        {

            Classifier classifier = (Classifier)weka.core.SerializationHelper.read("iris120.model");

            System.Console.WriteLine("----------------------------");

            weka.core.Attribute sepallength = new weka.core.Attribute("sepallength");
            weka.core.Attribute sepalwidth = new weka.core.Attribute("sepalwidth");
            weka.core.Attribute petallength = new weka.core.Attribute("petallength");
            weka.core.Attribute petalwidth = new weka.core.Attribute("petalwidth");
            FastVector labels = new FastVector();
            labels.addElement("Iris-setosa");
            labels.addElement("Iris-versicolor");
            labels.addElement("Iris-virginica");
            weka.core.Attribute cls = new weka.core.Attribute("class", labels);
            FastVector attributes = new FastVector();
            attributes.addElement(sepallength);
            attributes.addElement(sepalwidth);
            attributes.addElement(petallength);
            attributes.addElement(petalwidth);
            attributes.addElement(cls);
            Instances dataset = new Instances("TestInstances", attributes, 0);

            double[] …
Run Code Online (Sandbox Code Playgroud)

java weka

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

确定甲板洗牌的程度

我正在做一个小型扑克计划,我想确定一个牌组的洗牌程度.我有一张带有52张牌的List然后我运行我的洗牌算法,我希望能够确定牌组在某种程度上的洗牌程度.有人知道怎么做吗?谢谢

编辑:哇.很多回复.一切都很好但不完全是我想要的.这是我没有进一步指出我的问题的错.但我认为Saran最接近我真正想要的.我来说明一下.

我不想马上进行"完美"的洗牌.我已经读完了,我实施了Fisher-Yates.那个人很擅长"完美"的洗牌.我想要做的是模拟一个真实世界的情况,朋友们正在玩德州扑克,经销商拿着套牌并使用混合其他洗牌的浅滩洗牌来洗牌.最后,我想要的是一种衡量现实世界洗牌之间差异的方法.

一个例子.假设牌组总是新鲜的(对于所有四件套装来说,王牌适合王牌,然后是王牌王牌.)乔拿着甲板,做了2次浅口洗牌,其中一次切入.彼得做了5次剥离洗牌.我想找到一种方法,看看哪一个改组"更好".

我越想它越多,我认为它很难确定.

再次感谢.

编辑23.10.2013

这是我想出的方法,将Sarans的想法与我的想法结合起来:

 public int checkShuffle(List<Card> cardDeckToCheck,int[] previousOrder)
    {
        // Higher is worse? Sure.
        int score = 0;

        for (int i = 0; i < cardDeckToCheck.Count; i++)
        {
            Card cardToCheck = cardDeckToCheck[i];
            Card cardToLeft = null;
            Card cardToRight = null;

            // Should cost more since the card has not moved at all.
            // For this I need an array that shows me the arangement of the deck before shuffling.
            if(cardToCheck.index == previousOrder[i])
            {
                score += …
Run Code Online (Sandbox Code Playgroud)

c# random entropy

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

检索Firebase数据并将其返回的最佳方式,或替代方法

我正在使用Firebase进行一些项目,并且非常喜欢这个平台.

我偶然发现了一件我不能做的事情,并且想知道是否有任何方法可以实现它,或者是否有另一种方法可以做到这一点.

我要做的是创建一个函数来从我的Firebase数据库中检索最后X个条目并将数据返回给调用函数.

像这样的东西:

function getTwoLatestLocations()
{
    var twoLocations;
    myFirebaseRef.limitToLast(2).once('value', function (dataSnapshot) {
        twoLocations = dataSnapshot.val();
    }, function (errorObject) {
        // code to handle read error
        console.log("The read failed: " + errorObject.code);
    });

    return twoLocations;
}
Run Code Online (Sandbox Code Playgroud)

然后像这样调用它:

function someCalcutationsWithTheTwoLastLocations()
{
    var twoLastLocations = getTwoLatestLocations();
    // Do some calculations
}
Run Code Online (Sandbox Code Playgroud)

但正如您可能已经猜到的那样,对数据库引用的调用是异步的,因此返回的对象将始终未定义.

有没有办法优雅地做到这一点,所以我可以保持方法分离?

PS目前我的所有代码都只是在数据库调用中.丑陋.

javascript asynchronous firebase firebase-realtime-database

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

得到两点得到x截距

这可能是一个有点简单的问题,但我似乎无法让它工作.

我想找到给出两点的x截距.

让我说我有这两点:(5,3)和(3,4)我想找到x截距.目前这就是我所拥有的.哪个正确找到了y截距.在这种情况下5.5.

var A = [5, 3];
var B = [3, 4];

function slope(a, b) {
    if (a[0] == b[0]) {
        return null;
    }

    return (b[1] - a[1]) / (b[0] - a[0]);
}

function intercept(point, slope) {
    if (slope === null) {
        // vertical line
        return point[0];
    }

    return point[1] - slope * point[0];
}

var m = slope(A, B);
console.log(m);

var b = intercept(A, m);
console.log('intercept: ' + b);
Run Code Online (Sandbox Code Playgroud)

javascript linear-regression

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