疑心病

文章 评论 浏览 507

疑心病 2025-02-18 06:41:23

根据此文档 它说,它说,它说,

localhost 保留用于文档和测试目的
如果您在浏览器中访问“ http:// localhost”,则该请求将保留在您自己的系统中。

  • Localhost是指我们正在运行应用程序的机器/设备
  • 而不是本地主机,我们可以使用IP地址访问 127.0.0.1
  • Thynge @Harshithithaveeramalla-Mt进行评论,如果我们将Redirecturi作为 HTTP :// localhost:portnumber 该请求将发送到同一设备,我们

按照此 msdoc localhost重定向uris有一些例外

http和https uri对于localhost可以接受

可接受的参考文献:

https://www.ionos.com/digitalguide/server/server/know-how/localhost/

https://learn.microsoft.com/en-us/azure/azure/active-directory/develop/develop/reply-rreply-url #localhost-exceptions

As per this Document it says,

localhost is a domain reserved for documentation and testing purposes.
If you access "http://localhost" in the browser, the request will remain in your own system.

  • Localhost refers to the machine/device where we are running our Application
  • Instead of localhost we can access with IP address 127.0.0.1
  • Thanks @HarshithaVeeramalla-MT for the comment, If we give RedirectURI as http://localhost:portnumber the request will be sent to the same device where we are accessing the app

As per this MSDoc there are some exceptions for localhost redirect URIs

http and https URI's are acceptable for localhost

Taken References from:

https://www.ionos.com/digitalguide/server/know-how/localhost/

https://learn.microsoft.com/en-us/azure/active-directory/develop/reply-url#localhost-exceptions

什么是“ localhost” Azure重定向URL中的服务器

疑心病 2025-02-18 06:22:07

您可以检查解决方案。使用的flexbox以及有关响应性,只有文本大小会影响,因此请相应地调整文本大小。还要注意,为了样式目的,我在标记中添加了一些更改。让我知道它是否回答了您的问题。

/* style.css */
body {
    color: #000;
    font-family: 'Source Sans Pro', sans-serif;
}

h1, h2, h3, h4, h5, h6, p {
    font-family: 'Source Sans Pro', sans-serif;
}

.focus_area {
    width: 100%;
    display: flex;
    justify-content: center;
}

.focus_area .left {
    display: flex;
    flex-direction: column;
    max-width: 66.66666%;
    justify-content: space-between;
}

.focus_area .right {
    display: flex;
    flex-wrap: wrap;
    max-width: 33.33333%;
}

.left-top, .left-bottom {
    display: flex;
}

.left .focus {
    flex: 50%;
}

.focus_text {
    background: rgb(156, 166, 104);
    color: #fff;
    flex: 2;
    display: flex;
    margin: 2px;
}

.focus_text h2 {
    text-align: center;
    text-transform: uppercase;
    align-items: center;
    margin: auto;
    font-size: 16px;
}

.focus {
    position: relative;
    padding: 2px;
}

.right .focus img {
    max-width: 100%;
    height: auto;
}

.left .focus img {  
    max-width: 100%;
    height: auto;
}

.focus p {
    color: #fff;
    text-shadow: 0 0 black;
    font-size: 22px;
    position: absolute;
    bottom: 0px;
    padding-left: 15px;
    font-size: 14px;
}

/* tablet styles */
@media screen and (max-width: 768px) and (min-width: 481px) {
    .focus_area {
        flex-direction: column;
    }

    .focus_area .left, .focus_area .right {
        max-width: 100%;
    }

    .focus_text {
        padding: 50px 0px;
    }

    .focus_area .right {
        flex-wrap: nowrap;
    }
} /* end of tablet styles */

/* styles for mobile devices */
@media screen and (max-width: 480px) {
    .focus_area {
        flex-direction: column;
    }

    .focus_area .left, .focus_area .right {
        max-width: 100%;
    }

    .left-top, .left-bottom {
        display: block;
    }

    .focus_text {
        padding: 50px 0px;
    }
} /* end of mobile styles */
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
    <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@200;300;400;700&display=swap" rel="stylesheet" />
</head>
<body>
    <div class="container py-5">
        <div class="row">
            <div class="col-md-12">
                <h2 class="text-center">Some Title</h2>
            </div>
        </div>
    </div>

    <div class="container">
        <div class="focus_area">
            <div class="left">
                <div class="left-top">
                    <div class="focus">
                        <img src="https://i.ibb.co/wdRy4Wv/cities-and-shelter.png" alt="" class="img-fluid" />
                        <p>Cities & Shelters</p>
                    </div>
                    <div class="focus">
                        <img src="https://i.ibb.co/VCbRdbx/education-and-training.png" alt="" class="img-fluid" />
                        <p>Education & Training</p>
                    </div>
                </div>
                
                <div class="focus_text">
                    <h2>Delivering Humanitarian Relief Throughout The World</h2>
                </div>

                <div class="left-bottom">
                    <div class="focus">
                        <img src="https://i.ibb.co/0BT5vp5/energy-and-environment.png" alt="" class="img-fluid" />
                        <p>Energy & Environment</p>
                    </div>
                    <div class="focus">
                        <img src="https://i.ibb.co/bWpystL/jobs-and-business.png" alt="" class="img-fluid" />
                        <p>Jobs & Business</p>
                    </div>
                </div>
            </div>

            <div class="right">
                <div class="focus">
                    <img src="https://i.ibb.co/XX9Y7yH/health-and-fitness.png" alt="" class="img-fluid" />
                    <p>Health & Fitness</p>
                </div>
                <div class="focus">
                    <img src="https://i.ibb.co/3NSF6hj/food-and-water.png" alt="" class="img-fluid" />
                    <p>Food & Water</p>
                </div>
            </div>
        </div>
    </div>

    <div class="container py-5">
        <div class="row">
            <div class="col-md-12">
                <h2 class="text-center">Some Title</h2>
            </div>
        </div>
    </div>




    
</body>
</html>

You can check out the solution. Used flexbox and as for the responsiveness, only the text size will affect, so adjust the text size accordingly. Also to note that I added some changes in the markup for the style purposes. Let me know if it answered your question.

/* style.css */
body {
    color: #000;
    font-family: 'Source Sans Pro', sans-serif;
}

h1, h2, h3, h4, h5, h6, p {
    font-family: 'Source Sans Pro', sans-serif;
}

.focus_area {
    width: 100%;
    display: flex;
    justify-content: center;
}

.focus_area .left {
    display: flex;
    flex-direction: column;
    max-width: 66.66666%;
    justify-content: space-between;
}

.focus_area .right {
    display: flex;
    flex-wrap: wrap;
    max-width: 33.33333%;
}

.left-top, .left-bottom {
    display: flex;
}

.left .focus {
    flex: 50%;
}

.focus_text {
    background: rgb(156, 166, 104);
    color: #fff;
    flex: 2;
    display: flex;
    margin: 2px;
}

.focus_text h2 {
    text-align: center;
    text-transform: uppercase;
    align-items: center;
    margin: auto;
    font-size: 16px;
}

.focus {
    position: relative;
    padding: 2px;
}

.right .focus img {
    max-width: 100%;
    height: auto;
}

.left .focus img {  
    max-width: 100%;
    height: auto;
}

.focus p {
    color: #fff;
    text-shadow: 0 0 black;
    font-size: 22px;
    position: absolute;
    bottom: 0px;
    padding-left: 15px;
    font-size: 14px;
}

/* tablet styles */
@media screen and (max-width: 768px) and (min-width: 481px) {
    .focus_area {
        flex-direction: column;
    }

    .focus_area .left, .focus_area .right {
        max-width: 100%;
    }

    .focus_text {
        padding: 50px 0px;
    }

    .focus_area .right {
        flex-wrap: nowrap;
    }
} /* end of tablet styles */

/* styles for mobile devices */
@media screen and (max-width: 480px) {
    .focus_area {
        flex-direction: column;
    }

    .focus_area .left, .focus_area .right {
        max-width: 100%;
    }

    .left-top, .left-bottom {
        display: block;
    }

    .focus_text {
        padding: 50px 0px;
    }
} /* end of mobile styles */
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
    <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@200;300;400;700&display=swap" rel="stylesheet" />
</head>
<body>
    <div class="container py-5">
        <div class="row">
            <div class="col-md-12">
                <h2 class="text-center">Some Title</h2>
            </div>
        </div>
    </div>

    <div class="container">
        <div class="focus_area">
            <div class="left">
                <div class="left-top">
                    <div class="focus">
                        <img src="https://i.ibb.co/wdRy4Wv/cities-and-shelter.png" alt="" class="img-fluid" />
                        <p>Cities & Shelters</p>
                    </div>
                    <div class="focus">
                        <img src="https://i.ibb.co/VCbRdbx/education-and-training.png" alt="" class="img-fluid" />
                        <p>Education & Training</p>
                    </div>
                </div>
                
                <div class="focus_text">
                    <h2>Delivering Humanitarian Relief Throughout The World</h2>
                </div>

                <div class="left-bottom">
                    <div class="focus">
                        <img src="https://i.ibb.co/0BT5vp5/energy-and-environment.png" alt="" class="img-fluid" />
                        <p>Energy & Environment</p>
                    </div>
                    <div class="focus">
                        <img src="https://i.ibb.co/bWpystL/jobs-and-business.png" alt="" class="img-fluid" />
                        <p>Jobs & Business</p>
                    </div>
                </div>
            </div>

            <div class="right">
                <div class="focus">
                    <img src="https://i.ibb.co/XX9Y7yH/health-and-fitness.png" alt="" class="img-fluid" />
                    <p>Health & Fitness</p>
                </div>
                <div class="focus">
                    <img src="https://i.ibb.co/3NSF6hj/food-and-water.png" alt="" class="img-fluid" />
                    <p>Food & Water</p>
                </div>
            </div>
        </div>
    </div>

    <div class="container py-5">
        <div class="row">
            <div class="col-md-12">
                <h2 class="text-center">Some Title</h2>
            </div>
        </div>
    </div>




    
</body>
</html>

如何与CSS发出响应式网格

疑心病 2025-02-18 04:31:35

请检查是否可以重定向以用HTTP上下文签名,以配置启动类的服务。

options.Events.OnSignedOutCallbackRedirect = async context =>
{
    context.HttpContext.Response.Redirect(context.Options.SignedOutRedirectUri);
    context.HandleResponse();
};

并且请检查是否可以添加控制器以这种方式签字&gt; azure-b2c-logout-implentation-in-ass-ass-asp-net-core < /a>

参考:

azureadb2c.ui不允许自定义后定制后 -注销重定向URI·
·github

Please check if you can redirect to signout redirect with http context in configure services of start up class.

options.Events.OnSignedOutCallbackRedirect = async context =>
{
    context.HttpContext.Response.Redirect(context.Options.SignedOutRedirectUri);
    context.HandleResponse();
};

and please check if you could add controller to sign out this way > azure-b2c-logout-implementation-in-asp-net-core

Reference:

AzureADB2C.UI doesn't allow customizing post-logout redirect URI ·
· GitHub

Azure AD B2C登录问题

疑心病 2025-02-18 01:04:00

如果您解释了要样式的样式,我可能会提供一个更好的示例,但是您可以用* 25%/4 替换吗?这对我有用。

例子:

I might be able to give a better example if you explained what you were trying to style, but can you just replace the * 25% with a / 4? That works for me.

Example:
https://jsfiddle.net/o9mw5beu/

我如何修复sass calc width不起作用

疑心病 2025-02-17 18:53:26

如果您使用的是承诺,则此答案适合您。

这意味着Angularjs,jQuery(带延迟),本机 xhr“> xhr”> xhr href =“ https://en.wikipedia.org/wiki/ember.js” rel =“ noreferrer”> ember.js , backbone.js 's保存或任何 noreferrer“ .js 返回承诺的库。

您的代码应该与此相似:

function foo() {
    var data;
    // Or $.get(...).then, or request(...).then, or query(...).then
    fetch("/echo/json").then(function(response){
        data = response.json();
    });
    return data;
}

var result = foo(); // 'result' is always undefined no matter what.

Felix Kling做得很好为使用jQuery和回调的人写答案。我有一个本地XHR的答案。这个答案是用于对前端或后端上承诺的一般用法。


核心问题

在浏览器和服务器上使用node.js/io.js在服务器中的JavaScript并发模型是 asynchronous 反应性

每当您调用返回诺言的方法时,然后处理程序始终异步执行 - 也就是说, 下方的代码不是在中。然后处理程序。

这意味着,当您返回数据 处理程序尚未执行。反过来,这意味着您要返回的值尚未设置为正确的值。

这是一个简单的类比:

    function getFive(){
        var data;
        setTimeout(function(){ // Set a timer for one second in the future
           data = 5; // After a second, do this
        }, 1000);
        return data;
    }
    document.body.innerHTML = getFive(); // `undefined` here and not 5

data 的值是不确定的,因为 data = 5 零件尚未执行。它可能会在一秒钟内执行,但是到那时,它与返回的值无关。

由于该操作尚未发生(AJAX,服务器调用,I/O和计时器),您在请求有机会告诉您的代码是什么值之前返回值。

解决此问题的一种可能解决方案是代码 ,告诉您的程序完成计算后该怎么办。承诺通过本质上是暂时的(时间敏感)来积极实现这一目标。

快速回顾承诺的

承诺是随时间的价值。承诺有状态。他们从没有价值的待审开始,可以安定下来:

  • 实现意味着计算成功完成。
  • 拒绝意味着计算失败。

诺言只能改变状态 之后,它将永远保持在同一状态。您可以将附加处理程序附加,以承诺提取其价值并处理错误。 然后处理程序允许 chaning> chaning> chaning 。承诺由使用返回它们。例如,更现代的AJAX替换 Fetch 或jQuery的 $。get 返回承诺。

当我们调用。如果我们回报另一个诺言,我们会得到令人惊奇的事情,但让我们握住马匹。

有了承诺,

让我们看看如何通过承诺解决上述问题。首先,让我们通过使用 Promise构造函数用于创建延迟函数:

function delay(ms){ // Takes amount of milliseconds
    // Returns a new promise
    return new Promise(function(resolve, reject){
        setTimeout(function(){ // When the time is up,
            resolve(); // change the promise to the fulfilled state
        }, ms);
    });
}

现在,在我们转换的settimeout 要使用诺言,我们可以使用然后来计算:

function delay(ms){ // Takes amount of milliseconds
  // Returns a new promise
  return new Promise(function(resolve, reject){
    setTimeout(function(){ // When the time is up,
      resolve(); // change the promise to the fulfilled state
    }, ms);
  });
}

function getFive(){
  // We're RETURNING the promise. Remember, a promise is a wrapper over our value
  return delay(100).then(function(){ // When the promise is ready,
      return 5; // return the value 5. Promises are all about return values
  })
}
// We _have_ to wrap it like this in the call site, and we can't access the plain value
getFive().then(function(five){
   document.body.innerHTML = five;
});

基本上,而不是返回 value ,我们由于并发模型而无法做,而是我们返回a wrapper ,以获取我们可以 unwrap <的值/em>带有<代码>然后。就像一个框,您可以使用然后打开。

在原始API调用中应用

此信息相同,您可以:

function foo() {
    // RETURN the promise
    return fetch("/echo/json").then(function(response){
        return response.json(); // Process it inside the `then`
    });
}

foo().then(function(response){
    // Access the value inside the `then`
})

这样也可以。我们已经了解到,我们无法从已经异步的调用中返回值,但是我们可以使用诺言并将其链接来执行处理。现在,我们知道如何从异步呼叫中返回响应。

ES2015(ES6)

ES6引入是可以在中间返回然后恢复其点的功能。例如,这通常对于序列很有用,例如:

function* foo(){ // Notice the star. This is ES6, so new browsers, Nodes.js, and io.js only
    yield 1;
    yield 2;
    while(true) yield 3;
}

是一个函数,该函数可以通过序列返回序列 1,2,3,3,3,3,.... 可以迭代。尽管这本身很有趣,并为很多可能性打开了空间,但有一个特别的案例。

如果我们要产生的序列是一系列动作,而不是数字 - 我们可以在恢复函数之前等待动作并等待该功能。因此,我们需要一个 future 值的序列,而不是数字序列,也就是说:承诺。

这有点棘手,但非常有力的技巧让我们以同步的方式编写异步代码。有几个“跑步者”为您做到这一点。写一条是几行代码,但它超出了该答案的范围。我将在此处使用Bluebird的 Promise.coroutine ,但是还有其他包装器,例如 co <​​/code>或 q.async

var foo = coroutine(function*(){
    var data = yield fetch("/echo/json"); // Notice the yield
    // The code here only executes _after_ the request is done
    return data.json(); // 'data' is defined
});

此方法返回了一个承诺本身,我们可以从其他coroutines中消费。例如:

var main = coroutine(function*(){
   var bar = yield foo(); // Wait our earlier coroutine. It returns a promise
   // The server call is done here, and the code below executes when done
   var baz = yield fetch("/api/users/" + bar.userid); // Depends on foo's result
   console.log(baz); // Runs after both requests are done
});
main();

ES7中的ES2016(ES7)

,这是进一步标准化的。现在有几个建议,但是在所有建议中,您都可以等待承诺。这只是上述ES6提案的“糖”(较好的语法),通过添加 async 等待关键字。进行上面的示例:

async function foo(){
    var data = await fetch("/echo/json"); // Notice the await
    // code here only executes _after_ the request is done
    return data.json(); // 'data' is defined
}

它仍然返回承诺同样的示例:)

If you're using promises, this answer is for you.

This means AngularJS, jQuery (with deferred), native XHR's replacement (fetch), Ember.js, Backbone.js's save or any Node.js library that returns promises.

Your code should be something along the lines of this:

function foo() {
    var data;
    // Or $.get(...).then, or request(...).then, or query(...).then
    fetch("/echo/json").then(function(response){
        data = response.json();
    });
    return data;
}

var result = foo(); // 'result' is always undefined no matter what.

Felix Kling did a fine job writing an answer for people using jQuery with callbacks for Ajax. I have an answer for native XHR. This answer is for generic usage of promises either on the frontend or backend.


The core issue

The JavaScript concurrency model in the browser and on the server with Node.js/io.js is asynchronous and reactive.

Whenever you call a method that returns a promise, the then handlers are always executed asynchronously - that is, after the code below them that is not in a .then handler.

This means when you're returning data the then handler you've defined did not execute yet. This in turn means that the value you're returning has not been set to the correct value in time.

Here is a simple analogy for the issue:

    function getFive(){
        var data;
        setTimeout(function(){ // Set a timer for one second in the future
           data = 5; // After a second, do this
        }, 1000);
        return data;
    }
    document.body.innerHTML = getFive(); // `undefined` here and not 5

The value of data is undefined since the data = 5 part has not executed yet. It will likely execute in a second, but by that time it is irrelevant to the returned value.

Since the operation did not happen yet (Ajax, server call, I/O, and timer) you're returning the value before the request got the chance to tell your code what that value is.

One possible solution to this problem is to code re-actively, telling your program what to do when the calculation completed. Promises actively enable this by being temporal (time-sensitive) in nature.

Quick recap on promises

A Promise is a value over time. Promises have state. They start as pending with no value and can settle to:

  • fulfilled meaning that the computation completed successfully.
  • rejected meaning that the computation failed.

A promise can only change states once after which it will always stay at the same state forever. You can attach then handlers to promises to extract their value and handle errors. then handlers allow chaining of calls. Promises are created by using APIs that return them. For example, the more modern Ajax replacement fetch or jQuery's $.get return promises.

When we call .then on a promise and return something from it - we get a promise for the processed value. If we return another promise we'll get amazing things, but let's hold our horses.

With promises

Let's see how we can solve the above issue with promises. First, let's demonstrate our understanding of promise states from above by using the Promise constructor for creating a delay function:

function delay(ms){ // Takes amount of milliseconds
    // Returns a new promise
    return new Promise(function(resolve, reject){
        setTimeout(function(){ // When the time is up,
            resolve(); // change the promise to the fulfilled state
        }, ms);
    });
}

Now, after we converted setTimeout to use promises, we can use then to make it count:

function delay(ms){ // Takes amount of milliseconds
  // Returns a new promise
  return new Promise(function(resolve, reject){
    setTimeout(function(){ // When the time is up,
      resolve(); // change the promise to the fulfilled state
    }, ms);
  });
}

function getFive(){
  // We're RETURNING the promise. Remember, a promise is a wrapper over our value
  return delay(100).then(function(){ // When the promise is ready,
      return 5; // return the value 5. Promises are all about return values
  })
}
// We _have_ to wrap it like this in the call site, and we can't access the plain value
getFive().then(function(five){
   document.body.innerHTML = five;
});

Basically, instead of returning a value which we can't do because of the concurrency model - we're returning a wrapper for a value that we can unwrap with then. It's like a box you can open with then.

Applying this

This stands the same for your original API call, you can:

function foo() {
    // RETURN the promise
    return fetch("/echo/json").then(function(response){
        return response.json(); // Process it inside the `then`
    });
}

foo().then(function(response){
    // Access the value inside the `then`
})

So this works just as well. We've learned we can't return values from already asynchronous calls, but we can use promises and chain them to perform processing. We now know how to return the response from an asynchronous call.

ES2015 (ES6)

ES6 introduces generators which are functions that can return in the middle and then resume the point they were at. This is typically useful for sequences, for example:

function* foo(){ // Notice the star. This is ES6, so new browsers, Nodes.js, and io.js only
    yield 1;
    yield 2;
    while(true) yield 3;
}

Is a function that returns an iterator over the sequence 1,2,3,3,3,3,.... which can be iterated. While this is interesting on its own and opens room for a lot of possibility, there is one particular interesting case.

If the sequence we're producing is a sequence of actions rather than numbers - we can pause the function whenever an action is yielded and wait for it before we resume the function. So instead of a sequence of numbers, we need a sequence of future values - that is: promises.

This somewhat a tricky, but very powerful trick let’s us write asynchronous code in a synchronous manner. There are several "runners" that do this for you. Writing one is a short few lines of code, but it is beyond the scope of this answer. I'll be using Bluebird's Promise.coroutine here, but there are other wrappers like co or Q.async.

var foo = coroutine(function*(){
    var data = yield fetch("/echo/json"); // Notice the yield
    // The code here only executes _after_ the request is done
    return data.json(); // 'data' is defined
});

This method returns a promise itself, which we can consume from other coroutines. For example:

var main = coroutine(function*(){
   var bar = yield foo(); // Wait our earlier coroutine. It returns a promise
   // The server call is done here, and the code below executes when done
   var baz = yield fetch("/api/users/" + bar.userid); // Depends on foo's result
   console.log(baz); // Runs after both requests are done
});
main();

ES2016 (ES7)

In ES7, this is further standardized. There are several proposals right now, but in all of them you can await promise. This is just "sugar" (nicer syntax) for the ES6 proposal above by adding the async and await keywords. Making the above example:

async function foo(){
    var data = await fetch("/echo/json"); // Notice the await
    // code here only executes _after_ the request is done
    return data.json(); // 'data' is defined
}

It still returns a promise just the same :)

如何从异步电话中返回响应?

疑心病 2025-02-17 07:57:48
...
- apiVersion: apps/v1
    fieldsType: FieldsV1
    fieldsV1:
      f:spec:
        f:replicas: {}  # <-- replicas count has changed
    manager: kubectl
    operation: Update
    time: "2022-06-24T11:37:22Z"  # <-- at this time
...

kubectl量表状态满足sts-test -replicas = 0 默认情况下不会创建新的历史记录。

...
- apiVersion: apps/v1
    fieldsType: FieldsV1
    fieldsV1:
      f:spec:
        f:replicas: {}  # <-- replicas count has changed
    manager: kubectl
    operation: Update
    time: "2022-06-24T11:37:22Z"  # <-- at this time
...

kubectl scale statefulset sts-test --replicas=0 will not create a new history record by default.

为什么K8S状态表从1/1更改为0/0

疑心病 2025-02-17 07:45:30

您可以尝试此条件以浏览不同的页面,

RaisedButton(
                  child: Text('check'),
                  onPressed: () async {
    if (condition) {

      // navigate to the desired route

      Navigator.pushNamed(context, 'page1');

    } else if (condition) {

      // navigate to the desired route

      Navigator.pushNamed(context, 'page2');
    }
  },
 )

You can try this conditioning to navigate through different pages,

RaisedButton(
                  child: Text('check'),
                  onPressed: () async {
    if (condition) {

      // navigate to the desired route

      Navigator.pushNamed(context, 'page1');

    } else if (condition) {

      // navigate to the desired route

      Navigator.pushNamed(context, 'page2');
    }
  },
 )

导航到新页面时如何添加密码

疑心病 2025-02-17 06:20:42

您可以使用此功能:

def aggregate_over_questions( df ):
    data = pd.DataFrame()
    #get the number of questions
    questions = df.loc[:,df.columns.str.contains("^Q")].columns.tolist()

    for q in questions:
        temp = df.pivot_table(index=f"{q}", columns=['Gender'], values['ID'], aggfunc='count', fill_value=0)
        temp = (temp.join(out[['ID']].div(temp['ID'].sum(axis=1).values, axis=0)
                    .mul(100)
                    .rename(columns={'ID':'%Respondents'})))
       data = pd.concat( [data, temp], axis=0 )
    return data

image

You could use this function:

def aggregate_over_questions( df ):
    data = pd.DataFrame()
    #get the number of questions
    questions = df.loc[:,df.columns.str.contains("^Q")].columns.tolist()

    for q in questions:
        temp = df.pivot_table(index=f"{q}", columns=['Gender'], values['ID'], aggfunc='count', fill_value=0)
        temp = (temp.join(out[['ID']].div(temp['ID'].sum(axis=1).values, axis=0)
                    .mul(100)
                    .rename(columns={'ID':'%Respondents'})))
       data = pd.concat( [data, temp], axis=0 )
    return data

Image

如何使用Python进行循环执行内部功能?

疑心病 2025-02-16 06:09:58

我设法通过(并且知道这听起来很奇怪)将问题重命名为 pages 目录到 page 。我的猜测是,Cloudflare正在做一些奇怪的事情,但我真的不确定。

I managed to fix the issue by (and I know how odd this sounds) renaming the pages directory to page. My guess is that Cloudflare is doing some weird stuff with that, but I can't really be sure.

使用CloudFlare页面构建NPM在&#x27;找不到模块&#x27;

疑心病 2025-02-16 05:07:20

这是因为这一行:

self.PatientInsuranceCarrierImages = ko.observableArray(items);

您只是将一系列项目放入可观察的数组中。这样,您的 imageType 每个项目中的属性都不是可观察到的,因此敲除不会跟踪其更改。
要解决此问题,您需要将项目映射到代码段顶部的定义对象的集合:

self.PatientInsuranceCarrierImages = ko.observableArray(items.map(i => new PatientInsuranceCarrierImage(i)));

function PatientInsuranceCarrierImage(plainInsuranceImage) {
        var self = this;
        
        self.ImageTypes = ko.observableArray(plainInsuranceImage.ImageTypes);
        self.ImageType = ko.observable(plainInsuranceImage.ImageType);        
    }
    
    function PatientInsuranceCarrierImageViewModel(items) {
        var self = this;
        
        self.PatientInsuranceCarrierImages = ko.observableArray(items.map(i => new PatientInsuranceCarrierImage(i)));
        
        var innerImageTypes = JSON.parse('[{\"ID\":\"BackImage\",\"Name\":\"Back Image\"},{\"ID\":\"FrontImage\",\"Name\":\"Front Image\"},{\"ID\":\"Other\",\"Name\":\"Other\"}]');
        
        const newPatientInsuranceCarrierImage = {
            
            ImageType: "Other",
            ImageTypes: [],
        };

        for (let i = 0; i < innerImageTypes.length; i++) {
            newPatientInsuranceCarrierImage.ImageTypes.push(innerImageTypes[i]);
        }
        
         // Operations
   
        self.addpatientInsuranceCarrierImage = function() {
            self.PatientInsuranceCarrierImages.push(new PatientInsuranceCarrierImage(newPatientInsuranceCarrierImage));
        }
        
    }
    
    var plainImages = JSON.parse('[{\"ImageType\":\"Other\",\"ImageTypes\":[{\"ID\":\"BackImage\",\"Name\":\"Back Image\"},{\"ID\":\"FrontImage\",\"Name\":\"Front Image\"},{\"ID\":\"Other\",\"Name\":\"Other\"}]},{\"ImageType\":\"Other\",\"ImageTypes\":[{\"ID\":\"BackImage\",\"Name\":\"Back Image\"},{\"ID\":\"FrontImage\",\"Name\":\"Front Image\"},{\"ID\":\"Other\",\"Name\":\"Other\"}]},{\"ImageType\":\"Other\",\"ImageTypes\":[{\"ID\":\"BackImage\",\"Name\":\"Back Image\"},{\"ID\":\"FrontImage\",\"Name\":\"Front Image\"},{\"ID\":\"Other\",\"Name\":\"Other\"}]},{\"ImageType\":\"Other\",\"ImageTypes\":[{\"ID\":\"BackImage\",\"Name\":\"Back Image\"},{\"ID\":\"FrontImage\",\"Name\":\"Front Image\"},{\"ID\":\"Other\",\"Name\":\"Other\"}]}]');
    var patientInsuranceCarrierImagesViewModel = new PatientInsuranceCarrierImageViewModel(plainImages);
    ko.applyBindings(patientInsuranceCarrierImagesViewModel);
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div style="float: right; vertical-align: top; padding-bottom: 5px;">
           <a data-bind="click: addpatientInsuranceCarrierImage" href="#" class="button">Add New Image</a>
</div>
        
<table id="patientInsuranceImages" style="width: 100%;" class="alt1">
        <thead>
            <tr>
               <th class="Table_Top" style="width: 80px;">
                    Back/Front 
                </th>        
            </tr>
        </thead>
         <!-- ko if: PatientInsuranceCarrierImages().length > 0 -->
        <tbody data-bind="foreach: PatientInsuranceCarrierImages">
            <tr>                
                <td>
                    <select 
                        data-bind="options: ImageTypes, value: ImageType, optionsValue: 'ID', optionsText:'Name'"
                        class="txtinput"
                        style="margin-top: 0px;"> 
                    </select>
                    <input type="hidden" data-bind="value: ImageType, attr: {name: 'images[' + $index() + '].ImageType'}" />
                    <span data-bind="text: ImageType"></span>
                </td>                
            </tr>    
        </tbody>
        <!-- /ko -->
    </table>

It is because of this line:

self.PatientInsuranceCarrierImages = ko.observableArray(items);

You are just putting array of items into observable array. That way your ImageType property in each item is not observable so Knockout does not track changes of it.
To fix this you need to map that items into collection of your defined objects at the top of your code snippet:

self.PatientInsuranceCarrierImages = ko.observableArray(items.map(i => new PatientInsuranceCarrierImage(i)));

function PatientInsuranceCarrierImage(plainInsuranceImage) {
        var self = this;
        
        self.ImageTypes = ko.observableArray(plainInsuranceImage.ImageTypes);
        self.ImageType = ko.observable(plainInsuranceImage.ImageType);        
    }
    
    function PatientInsuranceCarrierImageViewModel(items) {
        var self = this;
        
        self.PatientInsuranceCarrierImages = ko.observableArray(items.map(i => new PatientInsuranceCarrierImage(i)));
        
        var innerImageTypes = JSON.parse('[{\"ID\":\"BackImage\",\"Name\":\"Back Image\"},{\"ID\":\"FrontImage\",\"Name\":\"Front Image\"},{\"ID\":\"Other\",\"Name\":\"Other\"}]');
        
        const newPatientInsuranceCarrierImage = {
            
            ImageType: "Other",
            ImageTypes: [],
        };

        for (let i = 0; i < innerImageTypes.length; i++) {
            newPatientInsuranceCarrierImage.ImageTypes.push(innerImageTypes[i]);
        }
        
         // Operations
   
        self.addpatientInsuranceCarrierImage = function() {
            self.PatientInsuranceCarrierImages.push(new PatientInsuranceCarrierImage(newPatientInsuranceCarrierImage));
        }
        
    }
    
    var plainImages = JSON.parse('[{\"ImageType\":\"Other\",\"ImageTypes\":[{\"ID\":\"BackImage\",\"Name\":\"Back Image\"},{\"ID\":\"FrontImage\",\"Name\":\"Front Image\"},{\"ID\":\"Other\",\"Name\":\"Other\"}]},{\"ImageType\":\"Other\",\"ImageTypes\":[{\"ID\":\"BackImage\",\"Name\":\"Back Image\"},{\"ID\":\"FrontImage\",\"Name\":\"Front Image\"},{\"ID\":\"Other\",\"Name\":\"Other\"}]},{\"ImageType\":\"Other\",\"ImageTypes\":[{\"ID\":\"BackImage\",\"Name\":\"Back Image\"},{\"ID\":\"FrontImage\",\"Name\":\"Front Image\"},{\"ID\":\"Other\",\"Name\":\"Other\"}]},{\"ImageType\":\"Other\",\"ImageTypes\":[{\"ID\":\"BackImage\",\"Name\":\"Back Image\"},{\"ID\":\"FrontImage\",\"Name\":\"Front Image\"},{\"ID\":\"Other\",\"Name\":\"Other\"}]}]');
    var patientInsuranceCarrierImagesViewModel = new PatientInsuranceCarrierImageViewModel(plainImages);
    ko.applyBindings(patientInsuranceCarrierImagesViewModel);
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div style="float: right; vertical-align: top; padding-bottom: 5px;">
           <a data-bind="click: addpatientInsuranceCarrierImage" href="#" class="button">Add New Image</a>
</div>
        
<table id="patientInsuranceImages" style="width: 100%;" class="alt1">
        <thead>
            <tr>
               <th class="Table_Top" style="width: 80px;">
                    Back/Front 
                </th>        
            </tr>
        </thead>
         <!-- ko if: PatientInsuranceCarrierImages().length > 0 -->
        <tbody data-bind="foreach: PatientInsuranceCarrierImages">
            <tr>                
                <td>
                    <select 
                        data-bind="options: ImageTypes, value: ImageType, optionsValue: 'ID', optionsText:'Name'"
                        class="txtinput"
                        style="margin-top: 0px;"> 
                    </select>
                    <input type="hidden" data-bind="value: ImageType, attr: {name: 'images[' + $index() + '].ImageType'}" />
                    <span data-bind="text: ImageType"></span>
                </td>                
            </tr>    
        </tbody>
        <!-- /ko -->
    </table>

选定的选项是不使用淘汰赛更新

疑心病 2025-02-16 04:55:08

如果您想在数字结束时摆脱0,则可以将其除以10,直到最后一个数字不是0或数字为0,以便您不会属于无限循环。

function removeZeros(n){
  while(n%10 === 0 && n!=0){
    n = Math.floor(n/10);
  }
  return n;
}
console.log(removeZeros(100));
console.log(removeZeros(1001));
console.log(removeZeros(-200));
console.log(removeZeros(-200200));

但是,如果您想删除所有零,则可以将数字转换为字符串,然后将所有“ 0”替换为“”。之后,您可以将其转换回数字:

function removeZeros(n){
  return Number(String(n).replaceAll("0",""));
}
console.log(removeZeros(100));
console.log(removeZeros(1001));
console.log(removeZeros(-200));
console.log(removeZeros(-200200));

If you want to get rid of 0 at the end of your number you can divide it by 10 until the last digit is not 0 or the number is 0 so you don't fall into infinite loop.

function removeZeros(n){
  while(n%10 === 0 && n!=0){
    n = Math.floor(n/10);
  }
  return n;
}
console.log(removeZeros(100));
console.log(removeZeros(1001));
console.log(removeZeros(-200));
console.log(removeZeros(-200200));

If you however want to remove all zeros you can convert the number into string and replace all "0" with "". After that you can convert it back to number:

function removeZeros(n){
  return Number(String(n).replaceAll("0",""));
}
console.log(removeZeros(100));
console.log(removeZeros(1001));
console.log(removeZeros(-200));
console.log(removeZeros(-200200));

如何使用JavaScript中的函数从数字中删除所有零?

疑心病 2025-02-15 20:56:23

无需在之间,网格 - 板块列值。
您也可以将其更改为自动,而不是自己进行计算,如果它们都相同并指定 25%
现在看看

let x = 0;

do{
    const square = document.createElement("div");
square.className = "squares";
square.setAttribute("id","block");
    document.getElementById("container").appendChild(square);
    x++;
}
while(x < 16);
html,body{
    height: 100%;
    margin: none;
}

#heading{
    height: 250px;
}


#wrapper{
    width: 600px;
    height: 600px;
    margin-left: auto;
    margin-right: auto;
}

#container{
    border: solid 1px;
    display: grid;
    grid-template-columns: auto auto auto auto;
    height: 600px;
    width: auto;
}

.squares{
    border: solid 1px rgba(0, 0, 0, 0.3);
}
<div id="container">

</div>

No need for the , between the grid-template-columns values.
You can also change it to auto instead of doing the calculation yourself if they are all the same and specify 25%.
take a look now

let x = 0;

do{
    const square = document.createElement("div");
square.className = "squares";
square.setAttribute("id","block");
    document.getElementById("container").appendChild(square);
    x++;
}
while(x < 16);
html,body{
    height: 100%;
    margin: none;
}

#heading{
    height: 250px;
}


#wrapper{
    width: 600px;
    height: 600px;
    margin-left: auto;
    margin-right: auto;
}

#container{
    border: solid 1px;
    display: grid;
    grid-template-columns: auto auto auto auto;
    height: 600px;
    width: auto;
}

.squares{
    border: solid 1px rgba(0, 0, 0, 0.3);
}
<div id="container">

</div>

CSS网格被覆盖,我不知道为什么

疑心病 2025-02-15 10:28:50

anoop rana 指出,只能默认特殊会员函数,并且,AS yksisarvinen 仅适用于内置类型。

超载运营商的冗余是一个长期以来的问题。
提供CRTP的常见过载,
包括操作员 - &gt;模仿内置行为:

#include <boost/operators.hpp>

struct S { int m;};

struct P : boost::dereferenceable< P, const S*>
{   auto& operator*() const { return s;}
    S s;
};

int main()
{   P p;
    p->m;
}

不幸的是,需要拼写返回类型。
(不应需要恕我直言。)
独自一人并不是向前迈出的一大步,但是
它被捆绑在通常需要的组中,例如 input_iteratable

As Anoop Rana pointed out, only special member functions can be defaulted, and, as Yksisarvinen said, the builtin operator-> exists only for builtin types.

Redundancy in overloaded operators is a long acknowledged problem.
Boost::Operators provides common overloads with CRTP,
including operator-> that mimics the builtin behavior:

#include <boost/operators.hpp>

struct S { int m;};

struct P : boost::dereferenceable< P, const S*>
{   auto& operator*() const { return s;}
    S s;
};

int main()
{   P p;
    p->m;
}

Unfortunately spelling out the return type is required.
(It shouldn't be required IMHO.)
Alone it isn't a big step forward, but
it's bundled in commonly needed groups like input_iteratable.

如果我不超载,将使用内置的操作符`?

疑心病 2025-02-13 18:59:58

当您想执行此操作时?
如果您想在ngoninit中使用此命令,此错误将为您出现。
您可以在ngafterviewinit上使用它,也可以在settimeout上使用它,例如

settimeout(()=&gt; {this.fileinput.click();},500); >

when you want to perform this action?
if you want use this command in ngOnInit this error appear for you.
you can use it on ngAfterViewInit or use it on setTimeOut for delay like this

setTimeout(() => { this.fileInput.click(); }, 500);

在Angular中引用其相应的打字稿文件中的文件输入

疑心病 2025-02-13 17:04:28

我尚未设法获得 image_dataset_from_directory 可以开箱即用的多标签。我最终要做的是创建一个没有标签的数据集,例如:

ds = tf.keras.utils.image_dataset_from_directory(
        image_dir,
        labels=None,
        ...
    )

然后,我将手动创建的多标签列表划过以下:

ds = tf.data.Dataset.zip((ds, tf.data.Dataset.from_tensor_slices(labels_list)))

I haven't managed to get image_dataset_from_directory to do multilabel out of the box. What I have ended up doing is creating a dataset with no labels e.g.:

ds = tf.keras.utils.image_dataset_from_directory(
        image_dir,
        labels=None,
        ...
    )

Then I zip a manually created list of multilabels into this:

ds = tf.data.Dataset.zip((ds, tf.data.Dataset.from_tensor_slices(labels_list)))

image_dataset_from_directory用于多标签分类

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文