も星光

文章 评论 浏览 27

も星光 2025-02-20 23:15:40

不,没有内置的方式来掌舵。在运行Helm升级命令时,您将必须使用解决方法,例如将标准错误重定向到 /dev /null。例如:

Helm升级2>/dev/null

No, there is no built-in way to do this in Helm. You will have to use a workaround such as redirecting standard error to /dev/null when running the Helm upgrade command. For example:

helm upgrade 2>/dev/null

运行“ Helm升级”但是抑制警告

も星光 2025-02-20 22:06:22

从YAML样本和日志中,您使用Azure CLI任务在ACR中登录。

但是您可以检查Azure CLI任务的日志。它包含步骤:

[命令]/usr/bin/az帐户清除

这意味着当Azure CLI任务完成时将清除凭据。

它不会传递给下一个任务。这是问题的根本原因。

您可以使用脚本或Bash任务执行AZ ACR登录命令。然后,凭据将传递给下一个任务。

要使用现有服务主体,您可以使用以下示例:

steps:
…
- task: AzureCLI@2
  displayName: 'Azure CLI '
  inputs:
    azureSubscription: xx
    scriptType: bash
    scriptLocation: inlineScript
    inlineScript: |
     echo "##vso[task.setvariable variable=ARM_CLIENT_ID]$servicePrincipalId" 
     
     echo "##vso[task.setvariable variable=ARM_CLIENT_SECRET]$servicePrincipalKey"
    
     echo "##vso[task.setvariable variable=ARM_TENANT_ID]$tenantId"
    addSpnToEnvironment: true

- bash: |
   az login --service-principal --username $(ARM_CLIENT_ID) --password $(ARM_CLIENT_SECRET)  --tenant $(ARM_TENANT_ID)'
   
   az acr login -n ****
  displayName: 'Bash Script'

From your YAML sample and the log, you are using Azure CLI task to login in the ACR.

But you can check the log of Azure CLI task. It contains the steps:

[command]/usr/bin/az account clear

This means that the credentials will be cleared when the Azure CLI task completing.

It will not be passed to the next tasks. This is the root cause of the issue.

You can use script or bash task to execute the az acr login command. Then the credentials will be pass to next tasks.

To use the existing Service Principal, you can use the following example:

steps:
…
- task: AzureCLI@2
  displayName: 'Azure CLI '
  inputs:
    azureSubscription: xx
    scriptType: bash
    scriptLocation: inlineScript
    inlineScript: |
     echo "##vso[task.setvariable variable=ARM_CLIENT_ID]$servicePrincipalId" 
     
     echo "##vso[task.setvariable variable=ARM_CLIENT_SECRET]$servicePrincipalKey"
    
     echo "##vso[task.setvariable variable=ARM_TENANT_ID]$tenantId"
    addSpnToEnvironment: true

- bash: |
   az login --service-principal --username $(ARM_CLIENT_ID) --password $(ARM_CLIENT_SECRET)  --tenant $(ARM_TENANT_ID)'
   
   az acr login -n ****
  displayName: 'Bash Script'

可流动管道到Azure容器注册表:“ AAD访问令牌具有SP失败的客户ID必须为GUID”

も星光 2025-02-20 12:47:19

您还有一个附加的类包裹在div(s)上。此外,您忘了将类包装在col-xl上。请参阅下面的代码段:

[class*="col"] {
  padding: 1rem;
  background-color: #33b5e5;
  border: 2px solid #fff;
  color: #fff;
}
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<div class="container-fluid text-center ">
    <div class="row">
        <div class="col-xxl">col1-xxl</div>
        <div class="col-xxl">col2-xxl</div>
    </div>
    <div class="row">
        <div class="col-xl">col1-xl</div>
        <div class="col-xl">col2-xl</div>
    </div>
    <div class="row">
        <div class="col-lg">col1-lg</div>
        <div class="col-lg">col2-lg</div>
    </div>
    <div class="row">
        <div class="col-md">col1-md</div>
        <div class="col-md">col2-md</div>
    </div>
    <div class="row">
        <div class="col-sm">col1-sm</div>
        <div class="col-sm">col2-sm</div>
    </div>
</div>

You had an additional row class wrapped around your div(s). Additionally, you forgot to wrap a row class around your col-xl. See code snippet below:

[class*="col"] {
  padding: 1rem;
  background-color: #33b5e5;
  border: 2px solid #fff;
  color: #fff;
}
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<div class="container-fluid text-center ">
    <div class="row">
        <div class="col-xxl">col1-xxl</div>
        <div class="col-xxl">col2-xxl</div>
    </div>
    <div class="row">
        <div class="col-xl">col1-xl</div>
        <div class="col-xl">col2-xl</div>
    </div>
    <div class="row">
        <div class="col-lg">col1-lg</div>
        <div class="col-lg">col2-lg</div>
    </div>
    <div class="row">
        <div class="col-md">col1-md</div>
        <div class="col-md">col2-md</div>
    </div>
    <div class="row">
        <div class="col-sm">col1-sm</div>
        <div class="col-sm">col2-sm</div>
    </div>
</div>

&quot“ col-xxl”正在添加液体容器引导

も星光 2025-02-20 05:23:20

MWAA限于安装dask == 2021.4.0。其他版本将不会安装,并且会破坏包装的整体安装。包版本约束的完整列表在这里: https://github.com/aws/aws-mwaa-local-runner/blob/main/main/docker/config/constraints.txts.txt

MWAA is constrained to installing dask==2021.4.0. Other versions will not install and will break package installation overall. The complete list of package version constraints is here: https://github.com/aws/aws-mwaa-local-runner/blob/main/docker/config/constraints.txt

在AWS MWAA气流上导入Python dask软件包不起作用

も星光 2025-02-19 22:01:28
import avatar from "../../../assets/images/avatar.png";

进而,

<img src={avatar} alt="profile" />
import avatar from "../../../assets/images/avatar.png";

and then,

<img src={avatar} alt="profile" />

如何在React JS中导入徽标图像?

も星光 2025-02-19 12:46:10

请不要忘记导入对象以访问CSS_SELECTOR属性。我必须导入以下内容以自动化Chrome浏览器中的任务。

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By

options = Options()
# options.add_experimental_option("detach", True)

driver = webdriver.Chrome(
    service=Service(ChromeDriverManager().install()),
     options=options
     )

driver.get("https://www.python.org/")
driver.maximize_window()

input = driver.find_element(By.CSS_SELECTOR,".documentation-widget p")

print(input)

driver.close()
driver.quit()

Please don't forget to import the By object to access the CSS_SELECTOR property. I had to import the following to automate tasks in the Chrome browser.

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By

options = Options()
# options.add_experimental_option("detach", True)

driver = webdriver.Chrome(
    service=Service(ChromeDriverManager().install()),
     options=options
     )

driver.get("https://www.python.org/")
driver.maximize_window()

input = driver.find_element(By.CSS_SELECTOR,".documentation-widget p")

print(input)

driver.close()
driver.quit()

如何修复webdriver&#x27;对象没有CSS选择器查找元素?

も星光 2025-02-18 22:16:21

您可以使其重载,而不是可选的参数。但是,您需要将“可选”移至参数包之前。

然后,第二个过载将使用“默认”参数集将参数转发到第一个。

#include <iostream>

template <typename... T>
void foo(void(func)(T...), int opt, T... args)
{
    std::cout << opt << '\n';
    func(args...);
}

template <typename... T>
void foo(void(func)(T...), T... args)
{
    return foo(func, 0, args...);    // forwards with the default set
}

void bar(int, int) {}

int main()
{
    foo(&bar, 1, 2);      // prints 0
    foo(&bar, 3, 1, 2);   // prints 3
}

您可能需要将可选的一路移动到第一个位置,以使功能及其参数在一起。这是一个味道。


另一个选项可能是排除可选参数,并且仅具有参数pack,并在存在时提取可选参数,或者如果没有,则使用默认值。
这要求您限制func的签名以匹配您要调用的功能。

#include <iostream>
#include <tuple>

template <class... T>
void foo(void func(int, int), T&&... args) {
    int opt = [](T... args) {
        if constexpr (sizeof...(T) > 2) return std::get<2>(std::tuple{args...});
        else return 0;  // use the default
    }(args...);

    std::cout << opt << '\n';

    [&func](int a, int b, auto&&...) { func(a, b); }(args...);
}

void bar(int, int) {}

int main() {
    foo(&bar, 1, 2);     // prints 0
    foo(&bar, 1, 2, 3);  // prints 3
}

以第二版为基础,但给予更多自由,您可以为func引入单独的参数包。如果该包的大小与所提供的参数相同,则需要为opt选择一个默认值。另一方面,如果它包含的比该功能所需的更多参数,则可以选择用于opt的额外参数之一。在下面的示例中,我刚选择了第一个额外参数。

#include <iostream>
#include <tuple>
#include <type_traits>
#include <utility>

// a helper to split a tuple in two:
template <class... T, size_t... L, size_t... R>
auto split_tuple(std::tuple<T...> t,
                     std::index_sequence<L...>,
                     std::index_sequence<R...>)
{
    return std::pair{
               std::forward_as_tuple(std::get<L>(t)...),
               std::forward_as_tuple(std::get<R+sizeof...(L)>(t)...)
           };
}

template <class... A, class... T>
void foo(void func(A...), T&&... args) {
    static_assert(sizeof...(T) >= sizeof...(A));
    
    // separate the needed function arguments from the rest:
    auto[func_args, rest] = 
        split_tuple(std::forward_as_tuple(std::forward<T>(args)...),
                    std::make_index_sequence<sizeof...(A)>{},
                    std::make_index_sequence<sizeof...(T)-sizeof...(A)>{});

    int opt = [](auto&& rest) {
        // if `rest` contains anything, pick the first one for `opt`
        if constexpr(sizeof...(T) > sizeof...(A)) return std::get<0>(rest);
        else return 0; // otherwise return a default value
    }(rest);

    std::cout << opt << '\n';

    std::apply(func, func_args);
}

void bar(int a, int b) {
    std::cout << a << ',' << b << '\n';
}

int main() {
    foo(&bar, 1, 2);        // prints 0 then 1,2
    foo(&bar, 1, 2, 3, 4);  // prints 3 then 1,2
}

You could make it overloaded instead of having an optional argument. You'd need to move the "optional" to before the parameter pack though.

The second overload would then just forward the arguments to the first, with the "default" parameter set.

#include <iostream>

template <typename... T>
void foo(void(func)(T...), int opt, T... args)
{
    std::cout << opt << '\n';
    func(args...);
}

template <typename... T>
void foo(void(func)(T...), T... args)
{
    return foo(func, 0, args...);    // forwards with the default set
}

void bar(int, int) {}

int main()
{
    foo(&bar, 1, 2);      // prints 0
    foo(&bar, 3, 1, 2);   // prints 3
}

You might want to move the optional all the way to the first position to let the function and its parameters be together. It's a matter of taste.


Another option could be to exclude the optional parameter and only have the parameter pack and to extract the optional if it's present or use the default value if it's not.
This requires that you restrict the signature of func to match the function you aim to call.

#include <iostream>
#include <tuple>

template <class... T>
void foo(void func(int, int), T&&... args) {
    int opt = [](T... args) {
        if constexpr (sizeof...(T) > 2) return std::get<2>(std::tuple{args...});
        else return 0;  // use the default
    }(args...);

    std::cout << opt << '\n';

    [&func](int a, int b, auto&&...) { func(a, b); }(args...);
}

void bar(int, int) {}

int main() {
    foo(&bar, 1, 2);     // prints 0
    foo(&bar, 1, 2, 3);  // prints 3
}

Building on the second version but giving a lot more freedom, you could introduce a separate parameter pack for func. If that pack has the same size as pack of arguments supplied, you need to pick a default value for opt. If it on the other hand contains more arguments than needed for the function, you can select which one of the extra arguments that should be used for opt. In the example below, I just picked the first extra parameter.

#include <iostream>
#include <tuple>
#include <type_traits>
#include <utility>

// a helper to split a tuple in two:
template <class... T, size_t... L, size_t... R>
auto split_tuple(std::tuple<T...> t,
                     std::index_sequence<L...>,
                     std::index_sequence<R...>)
{
    return std::pair{
               std::forward_as_tuple(std::get<L>(t)...),
               std::forward_as_tuple(std::get<R+sizeof...(L)>(t)...)
           };
}

template <class... A, class... T>
void foo(void func(A...), T&&... args) {
    static_assert(sizeof...(T) >= sizeof...(A));
    
    // separate the needed function arguments from the rest:
    auto[func_args, rest] = 
        split_tuple(std::forward_as_tuple(std::forward<T>(args)...),
                    std::make_index_sequence<sizeof...(A)>{},
                    std::make_index_sequence<sizeof...(T)-sizeof...(A)>{});

    int opt = [](auto&& rest) {
        // if `rest` contains anything, pick the first one for `opt`
        if constexpr(sizeof...(T) > sizeof...(A)) return std::get<0>(rest);
        else return 0; // otherwise return a default value
    }(rest);

    std::cout << opt << '\n';

    std::apply(func, func_args);
}

void bar(int a, int b) {
    std::cout << a << ',' << b << '\n';
}

int main() {
    foo(&bar, 1, 2);        // prints 0 then 1,2
    foo(&bar, 1, 2, 3, 4);  // prints 3 then 1,2
}

可选的参数后,模板参数包的据称已知长度的参数包

も星光 2025-02-18 10:28:36

请致电行动

在审查下面的示例时,

  1. :等待5秒钟的&lt; video&gt;以结束
  2. &lt; dialog&gt;,并用&lt; form&gt; 将打开
  3. 输入所需的数据并提交
  4. 数据将提交到实时测试服务器
  5. &lt; dialog&gt;将关闭
  6. &lt; iframe&gt; 将出现在&lt; video&gt;下,并带有服务器响应
    ✺不需要 - 仅添加例如

详细信息在示例中评论

// Reference <video>, <dialog>, and <form>
const vid = document.querySelector('video');
const mod = document.querySelector('dialog');
const con = document.forms[0];
// Bind the 'ended' event to <video>
vid.onended = cta;
/*
Event handler passes Event Object by default
Hide, pause, and reset <video>
Open <dialog>
*/
function cta(e) {
  vid.style.display = 'none';
  vid.pause();
  vid.currentTime = 0;
  mod.showModal();
}

// Bind 'click' and 'submit' events to <form>
con.onclick = close;
con.onsubmit = close;

/*
If the user clicked .close OR <form> is submitted...
...close <dialog>...
...show <video> and add controls
*/
function close(e) {
  if (e.target.matches('.close') || e.type === 'submit') {
    mod.close();
    vid.style.display = 'block';
    vid.controls = true;
  }
}

// This was added so you don't have to sit and wait for the whole video to end
vid.ontimeupdate = quit;

function quit(e) {
  if (this.currentTime >= 5) {
    this.currentTime = this.duration;
  }
};
html {
  font: 300 2ch/1 'Segoe UI'
}

video {
  display: block;
  margin: 20px auto 10px;
}

dialog {
  padding-right: 5px;
  padding-bottom: 8px;
  border-radius: 4px;
}

fieldset {
  border-radius: 4px;
}

legend {
  font-size: 1.2rem
}

input {
  font: inherit;
  margin-bottom: 6px;
}

button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font: inherit;
  float: right;
  cursor: pointer;
}

button::before {
  content: attr(value);
}

#close {
  width: 1rem;
  height: 1rem;
  margin: -12px 0 0 4px;
  padding: 0 1px 3px;
  outline: 0;
}

sup {
  font-size: 0.6rem;
  color: red;
}

input+sup {
  display: inline-block;
  margin: 0 -8px 0 1px;
}

small+sup,
small {
  float: right;
}

small {
  display: inline-block;
  margin-right: 20px;
}

iframe {
  display: block;
  margin: 0 auto;
  border: 0;
}
<video src='https://glpjt.s3.amazonaws.com/so/av/vs12s3.mp4' width='240' autoplay muted></video>
<dialog>
  <form action='https://httpbin.org/post' method='post' target='response'>
    <button id='close' class='close' type='button' value='x'></button>
    <fieldset>
      <legend>Subscribe</legend>
      <input name='user' type='text' placeholder='User Name' required><sup>✱</sup><br>
      <input name='email' type='email' placeholder='Email Address' required><sup>✱</sup><br>
      <button value='Submit'></button>
      <button class='close' type='button' value='Cancel'></button>
    </fieldset>
    <small>Required</small><sup>✱</sup>
  </form>
</dialog>
<iframe name='response' width='240'></iframe>

Call to Action

When reviewing the example below:

  1. wait 5 seconds for the <video> to end
  2. a <dialog> with a <form> will open
  3. enter the required data and submit it
  4. data will be submitted to a live test server
  5. the <dialog> will close
  6. an <iframe> will appear under the <video> with the server response
    ✺Not required -- only added for example

Details are commented in example

// Reference <video>, <dialog>, and <form>
const vid = document.querySelector('video');
const mod = document.querySelector('dialog');
const con = document.forms[0];
// Bind the 'ended' event to <video>
vid.onended = cta;
/*
Event handler passes Event Object by default
Hide, pause, and reset <video>
Open <dialog>
*/
function cta(e) {
  vid.style.display = 'none';
  vid.pause();
  vid.currentTime = 0;
  mod.showModal();
}

// Bind 'click' and 'submit' events to <form>
con.onclick = close;
con.onsubmit = close;

/*
If the user clicked .close OR <form> is submitted...
...close <dialog>...
...show <video> and add controls
*/
function close(e) {
  if (e.target.matches('.close') || e.type === 'submit') {
    mod.close();
    vid.style.display = 'block';
    vid.controls = true;
  }
}

// This was added so you don't have to sit and wait for the whole video to end
vid.ontimeupdate = quit;

function quit(e) {
  if (this.currentTime >= 5) {
    this.currentTime = this.duration;
  }
};
html {
  font: 300 2ch/1 'Segoe UI'
}

video {
  display: block;
  margin: 20px auto 10px;
}

dialog {
  padding-right: 5px;
  padding-bottom: 8px;
  border-radius: 4px;
}

fieldset {
  border-radius: 4px;
}

legend {
  font-size: 1.2rem
}

input {
  font: inherit;
  margin-bottom: 6px;
}

button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font: inherit;
  float: right;
  cursor: pointer;
}

button::before {
  content: attr(value);
}

#close {
  width: 1rem;
  height: 1rem;
  margin: -12px 0 0 4px;
  padding: 0 1px 3px;
  outline: 0;
}

sup {
  font-size: 0.6rem;
  color: red;
}

input+sup {
  display: inline-block;
  margin: 0 -8px 0 1px;
}

small+sup,
small {
  float: right;
}

small {
  display: inline-block;
  margin-right: 20px;
}

iframe {
  display: block;
  margin: 0 auto;
  border: 0;
}
<video src='https://glpjt.s3.amazonaws.com/so/av/vs12s3.mp4' width='240' autoplay muted></video>
<dialog>
  <form action='https://httpbin.org/post' method='post' target='response'>
    <button id='close' class='close' type='button' value='x'></button>
    <fieldset>
      <legend>Subscribe</legend>
      <input name='user' type='text' placeholder='User Name' required><sup>✱</sup><br>
      <input name='email' type='email' placeholder='Email Address' required><sup>✱</sup><br>
      <button value='Submit'></button>
      <button class='close' type='button' value='Cancel'></button>
    </fieldset>
    <small>Required</small><sup>✱</sup>
  </form>
</dialog>
<iframe name='response' width='240'></iframe>

使用JavaScript在网站上结束视频后,如何显示联系表?

も星光 2025-02-18 04:33:55

为什么要提出不同的计划相对容易解释。首先,删除无法使用并行查询,因此据信更易于友好的计划更受到选择而不是删除的青睐。也许将来的一些限制将在某些版本中得到缓解。其次,删除不能像纯select can一样在ma_tx_out_pkey上使用folly-scan,而是使用索引扫描。这也将使删除的速度更快的速度比选择要少。这两个因素的总和显然足以使IT切换计划。我们已经看到了第一个因素的证据,您可能可以通过设置enable_seqscan关闭并查看删除选择的计划来验证这一第二个因素,如果是嵌套的循环,验证了最后一个索引扫描不是索引,则。

但是,当然,这些因素可以使计划之间的决策不同的唯一原因是,尽管计划估计在实际绩效上截然不同,但计划的估计是如此之近。那么,什么解释了这种错误的亲密关系?使用我们拥有的信息很难确定(如果您已经完成解释(分析,缓冲区)使用TRACK_IO_TIMING打开)。

一种可能性是实际绩效的差异是虚幻的。也许嵌套循环之所以如此之快,只是因为它需要的所有数据都在内存中,而唯一的原因是您使用与测试的一部分相同的参数反复执行相同的查询。如果您更改时间戳params,还是清除运行之间的postgresql缓冲区和文件缓存?

另一种可能性是您的系统的调整很差。例如,如果您的数据在SSD上,则Random_page_cost的默认设置可能太高了。 1.1可能比4更合理。

最后,您的工作设置可能太低了。这导致了使用奢侈数量的批次:8192。这是一个很难预测的性能,因为这取决于您的硬件,内核,文件系统等(这也许就是为什么计划者不尝试尝试尝试考虑到)。它非常容易测试,您可以在本地(在会话中)增加Work_mem的设置,并查看它是否改变了速度。

仅基于您的删除实际上找不到任何行删除的事实,就可以进行大部分分析。如果删除行,那将使情况更加复杂。

Why it comes up with different plans is relatively easy to explain. First, the DELETE cannot use parallel queries, so the plan which is believed to be more parallel-friendly is more favored by the SELECT rather than the DELETE. Maybe that restriction will be eased in some future version. Second, the DELETE cannot use an index-only-scan on ma_tx_out_pkey, like the pure SELECT can--it would use an index scan instead. This too will make the faster plan appear less fast for the DELETE than it does for the SELECT. These two factors combined are apparently enough to get it switch plans. We have already seen evidence of the first factor, You can probably verify this 2nd factor by setting enable_seqscan to off and seeing what plan the DELETE chooses then, and if it is the nested loop, verifying that the last index scan is not index-only.

But of course the only reason those factors can make the decision between plans differ is because the plan estimates were so close together in the first place, despite being so different in actual performance. So what explains that false closeness? That is harder to determine with the info we have (it would be better if you had done EXPLAIN (ANALYZE, BUFFERS) with track_io_timing turned on).

One possibility is that the difference in actual performance is illusory. Maybe the nested loop is so fast only because all the data it needs is in memory, and the only reason for that is that you executed the same query repeatedly with the same parameters as part of your testing. Is it still so fast if you change the timestamps params, or clear both the PostgreSQL buffers and the file cache between runs?

Another possibility is that your system is just poorly tuned. For example, if your data is on SSD, then the default setting of random_page_cost is probably much too high. 1.1 might be a more reasonable setting than 4.

Finally, your setting of work_mem is probably way too low. That results in the hash using an extravagant number of batches: 8192. How much this effects the performance is hard predict, as it depends on your hardware, your kernel, your filesystem, etc. (Which is maybe why the planner does not try to take it into account). It is pretty easy to test, you can increase the setting of work_mem locally (in your session) and see if it changes the speed.

Much of this analysis is possible only based on the fact that your delete doesn't actually find any rows to delete. If it were deleting rows, that would make the situation far more complex.

相同的选择vs删除查询创建不同的查询计划,而执行时间却大不相同

も星光 2025-02-18 03:23:09

组对其进行排序,日期。 SAS将自动处理数据。根据数据的结构方式,您可能需要使用选择不同的

proc sql;
    create table want as
        select distinct 
               regionName 
             , date
             , sum(sale) as sum_sale
        from sashelp.pricedata
        group by regionName
        order by regionName, date
    ;
quit;

您会在日志中看到:

注意:查询需要用原始数据恢复摘要统计信息。

这是SAS自动为您做以下操作:

proc sql;
    create table want as
        select distinct 
               t1.regionName
             , t1.date
             , t2.sum_sale
        from sashelp.priceData as t1
        LEFT JOIN
             (select regionName, sum(sale) as sum_sale
              from sashelp.pricedata
              group by regionName
             ) as t2
        ON t1.regionName = t2.regionName 
        order by regionName, date
    ;
quit;

Sort it by group, date. SAS will handle remerging the data automatically. Depending on how your data is structured, you may need to use select distinct.

proc sql;
    create table want as
        select distinct 
               regionName 
             , date
             , sum(sale) as sum_sale
        from sashelp.pricedata
        group by regionName
        order by regionName, date
    ;
quit;

You'll see in the log:

NOTE: The query requires remerging summary statistics back with the original data.

This is SAS automatically doing the following for you:

proc sql;
    create table want as
        select distinct 
               t1.regionName
             , t1.date
             , t2.sum_sale
        from sashelp.priceData as t1
        LEFT JOIN
             (select regionName, sum(sale) as sum_sale
              from sashelp.pricedata
              group by regionName
             ) as t2
        ON t1.regionName = t2.regionName 
        order by regionName, date
    ;
quit;

如何在Proc SQL语句中分类组

も星光 2025-02-18 02:04:00

我通过为记录文件设置最大尺寸限制来解决此问题。

version: "3.9"

services:
  db:
    image: mysql:5.7
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    logging:
        driver: "json-file"
        options:
          max-size: "10m"
          max-file: "5"
    environment:
      MYSQL_ROOT_PASSWORD: xx
      MYSQL_DATABASE: xx
      MYSQL_USER: xx
      MYSQL_PASSWORD: xx

  wordpress:
    depends_on:
      - db
    image: wordpress:latest
    volumes:
      - wordpress_data:/var/www/html
      - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
      - ./xxx:/var/www/html/wp-content/themes/xx
    ports:
      - "80:80"
    restart: always
    logging:
        driver: "json-file"
        options:
          max-size: "10m"
          max-file: "5"
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: xx
      WORDPRESS_DB_PASSWORD: xx
      WORDPRESS_DB_NAME: xx

  phpmyadmin:
    image: corbinu/docker-phpmyadmin
    links:
      - db:mysql
    ports:
      - 8181:80
    environment:
      MYSQL_USERNAME: xxx
      MYSQL_ROOT_PASSWORD: xxx
      MYSQL_PORT_3306_TCP_ADDR: db
volumes:
  db_data: {}
  wordpress_data: {}

I fixed this issue by setting a max size limit for logging files.

version: "3.9"

services:
  db:
    image: mysql:5.7
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    logging:
        driver: "json-file"
        options:
          max-size: "10m"
          max-file: "5"
    environment:
      MYSQL_ROOT_PASSWORD: xx
      MYSQL_DATABASE: xx
      MYSQL_USER: xx
      MYSQL_PASSWORD: xx

  wordpress:
    depends_on:
      - db
    image: wordpress:latest
    volumes:
      - wordpress_data:/var/www/html
      - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
      - ./xxx:/var/www/html/wp-content/themes/xx
    ports:
      - "80:80"
    restart: always
    logging:
        driver: "json-file"
        options:
          max-size: "10m"
          max-file: "5"
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: xx
      WORDPRESS_DB_PASSWORD: xx
      WORDPRESS_DB_NAME: xx

  phpmyadmin:
    image: corbinu/docker-phpmyadmin
    links:
      - db:mysql
    ports:
      - 8181:80
    environment:
      MYSQL_USERNAME: xxx
      MYSQL_ROOT_PASSWORD: xxx
      MYSQL_PORT_3306_TCP_ADDR: db
volumes:
  db_data: {}
  wordpress_data: {}

WordPress Docker组成的磁盘空间正在爆炸

も星光 2025-02-17 07:30:59

我的示例中有2个问题。

Anon Coward正确地确定需要重置内存的位置。

另一个问题是putobjectRequest.md5digest期望base64表示(即使AWS在ETAG中显示MD5 Hash作为HEX)。

代码的哈希部分应该看起来像这样,两个问题已固定

memoryStream.Position = 0;
using (MD5 md5 = MD5.Create())
{
    byte[] hash = md5.ComputeHash(memoryStream);
    md5Hash = Convert.ToBase64String(hash);
}

There were 2 issues in my example.

Anon Coward correctly identified that the position of the MemoryStream needed to be reset.

The other problem is that PutObjectRequest.MD5Digest expects a base64 representation (even though AWS shows MD5 hash in Etag as hex).

The hash section of the code should look like this with both issues fixed

memoryStream.Position = 0;
using (MD5 md5 = MD5.Create())
{
    byte[] hash = md5.ComputeHash(memoryStream);
    md5Hash = Convert.ToBase64String(hash);
}

GZZ Memorystream到S3桶散列错误

も星光 2025-02-17 07:19:19

这是一个非常简单的想法,您在数组中定义了类别。该值是类别和图像的同名。

如果类别名称在字段中,则加载图像(.jpg)并返回HTML字符串

PHP函数

<?php 

function imageToCat(){
    // get the category variable from WordPress
    $categories = get_the_category();

    // definite array image
    $category =[
        'Allgemein','Cat B'
    ];

    if(in_array($categories[0]->cat_name,$category)){
        // If the cat_name is in array
        return '<img src="'.get_stylesheet_directory_uri().'/image_path/'.$categories[0]->cat_name.'.jpg" alt="" >';

    } // else { echo 'not in Array!';}
}
?>

,您可以在HTML文件中调用该函数作为一个示例

<header>
    <h1><?php echo imageToCat();?>  Your Title</h1>
</header>

This is a very simple idea, you define the category in the array. The value is the same name of the category and the image.

If the category name is in the field, then load the image (.jpg) and return the html string

PHP Function

<?php 

function imageToCat(){
    // get the category variable from WordPress
    $categories = get_the_category();

    // definite array image
    $category =[
        'Allgemein','Cat B'
    ];

    if(in_array($categories[0]->cat_name,$category)){
        // If the cat_name is in array
        return '<img src="'.get_stylesheet_directory_uri().'/image_path/'.$categories[0]->cat_name.'.jpg" alt="" >';

    } // else { echo 'not in Array!';}
}
?>

You can call the function in your HTML file with as an an example

<header>
    <h1><?php echo imageToCat();?>  Your Title</h1>
</header>

显示标题旁边的图标或文字-WordPress

も星光 2025-02-17 05:05:04

您必须创建firebasemessaging实例。更改为:

@override
void initState() {
  FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance; // Change here
  _firebaseMessaging.getToken().then((token){
    print("token is $token");
  });
}

You have to create the FirebaseMessaging instance. Change to:

@override
void initState() {
  FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance; // Change here
  _firebaseMessaging.getToken().then((token){
    print("token is $token");
  });
}

如何使设备令牌扑来

も星光 2025-02-17 04:44:44
  • 为什么有如此多的州管理替代方案?

    Flutter团队在一开始就没有认可解决方案,社区开始生下我们现在拥有的许多选择


  • 这一切都归结为仅仅是表现吗?

    并非真的,如果不经意使用,您可能会通过SetState或任何其他解决方案获得不良/良好的性能。其他国家管理解决方案确实允许关于何时重建UI或其中的各个部分的更多粒度,但是他们所做的更好的是应用这些优化甚至默认为某些人的方便(例如:Bloc或Riverpod如何不重建) UI如果发射状态相同)。

setState 的许多部分都没有任何错误,而且许多部分都会使用它。我更喜欢它短暂的状态(如Flutter Team所述),而不是应用程序状态,因为它与UI和widget链接了太多的应用程序状态生命周期。

当然,您可以仅使用setState进行整个应用程序,但是其他选项(例如简化的窗口小部件),RiverPod或bloc将UI从“应用程序状态”或业务逻辑中解脱出来。它们使从UI隔离行为并对其进行测试变得更加容易。 简单状态管理的一个很好的例子官方文档,甚至使用骨架模板创建一个新项目flutter创建样本-t骨架,这是Flutter团队的指导,我同意这是非常好的默认值。

  • Why are there so many state management alternatives?

    The Flutter team did not endorsed a solution in the beginning and the community started to roll their own giving birth to the many options we have now


  • Does it all come down to just performance?

    Not really you could get bad/good performance with setState or any other solution if used carelessly. Other state management solutions do permit more granularity regarding when to rebuild the UI or sections of it, but what they do make better is how convenient is to apply those optimizations or even default to some of them (eg: how Bloc or Riverpod do not rebuild the UI if the emitted states are the same).

There is nothing inherently wrong with setState and many parts of flutter use it .I prefer it for ephemeral state (as explained by the flutter team) , not app state as it ties a little bit too much your app state with the UI and widget lifecycle.

You can certainly do a whole app using only setState but other options like provider(which is mostly just Inherited Widgets simplified), riverpod, or bloc decouple the UI from the "App state" or business logic. They make it easier to segregate behavior from UI and test it. A great example of simple state management is in the official docs or even creating a new project using the skeleton template flutter create sample -t skeleton which are guidelines by the flutter team and I agree that are very good defaults.

SETSTATE怎么了?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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