濫情▎り

文章 评论 浏览 29

濫情▎り 2025-02-04 13:54:02

所以,
在第一部分中,我知道无法通过反思来找出是否使用了类:(
在第二部分中,如果您用nswag替换swashbuckle,您实际上可以在Swagger UI中拥有这种不错的“之一” - 但是,就我而言,这还不够。

So,
for the first part, what I understand it is not possible to find out if a class is used or not via reflection :(
And for the second part, if you replace the swashbuckle with nswag you are actually able to have this nice "one of" -feature in the swagger UI :) But in my case that is not enough so I guess this is not possible right now.

宣传文档的动态摘要

濫情▎り 2025-02-04 03:47:20

一般而言(总会有例外),多线程最适合IO结合处理(包括网络)。多处理非常适合CPU密集型活动。

因此,您的测试是有缺陷的。

您的意图显然是要进行某种网络爬行,但这并不是在测试代码中发生的,这意味着您的测试是CPU密集型的,因此不适合多线程。鉴于,一旦添加了网络代码,您可能会发现,只要您使用了合适的技术,就可以改善。

查看consturrent.futures中的threadpoolexecutor。您可能会发现这特别有用,因为您可以通过简单地用ProcessPoolExecutor替换ThreadPoolExecutor来交换多处理,这将使您的实验更容易量化

As a general rule (there will always be exceptions) multithreading is best suited to IO-bound processing (this includes networking). Multiprocessing is well suited to CPU-intensive activities.

Your testing is therefore flawed.

Your intention is clearly to do some kind of web-crawling but that's not happening in your test code which means that your test is CPU-intensive and therefore not suitable for multi-threading. Whereas, once you've added your networking code you may find that matters have improved providing you've used suitable techniques.

Take a look at ThreadPoolExecutor in concurrent.futures. You may find that useful in particular because you can swap to multiprocessing by simply replacing ThreadPoolExecutor with ProcessPoolExecutor which will make your experiments easier to quantify

多线程不改善Python的结果?

濫情▎り 2025-02-02 22:33:13

这就是eigen :: ref是用来的。 “如何写通用但非塑造功能?

请参阅 这样:


void consume_matrix(const Eigen::Ref<const Eigen::MatrixXd>& in);
void produce_matrix(Eigen::Ref<Eigen::MatrixXd> out);


void foo()
{
    Eigen::MatrixXd matrix = ...;
    produce_matrix(matrix.middleRows(start, len));
    consume_matrix(matrix.leftCols(len));
}

存储块引用

eigen不带有非常适合保留矩阵的“借用”块表达式的类型。对于这种情况,我不推荐ref,因为它太容易了,无法指出临时分配,这很容易导致悬挂的指针。

最终,存储借来的观点是从根本上不安全的操作。但是,如果您绝对必须这样做,我将使用eigen :: Map。至少这清楚地表明,您不拥有所引用的内存。类似的事情:

struct MatrixReference
{
  using map_type = Eigen::Map<
    Eigen::MatrixXd, Eigen::Unaligned, Eigen::OuterStride<> >;

  map_type matrix;

  template<class Derived>
  static map_type to_map(const Eigen::DenseBase<Derived>& matrix) noexcept
  {
    assert(matrix.innerStride() == 1);
    return map_type(const_cast<double*>(matrix.derived().data()),
                    matrix.rows(), matrix.cols(),
                    Eigen::OuterStride<>(matrix.outerStride()));
  }

  MatrixReference() noexcept
  : matrix(nullptr, 0, 0, Eigen::OuterStride<>(1))
  {}
  template<class Derived>
  explicit MatrixReference(const Eigen::DenseBase<Derived>& matrix) noexcept
    : matrix(to_map(matrix))
  {}
  MatrixReference(const MatrixReference&) = default;
  MatrixReference& operator=(const MatrixReference& o) noexcept
  {
    // placement-new because assignment would overwrite the content
    new (&matrix) map_type(o.matrix);
    return *this;
  }
};
int main()
{
  Eigen::MatrixXd mat = Eigen::MatrixXd::Random(4, 5);
  MatrixReference ref(mat.topRows(2));
  std::cout << mat << "\n\n" << ref.matrix << "\n\n";
}

一个稍微更安全的选项是将shared_ptr保留到矩阵中,并存储信息单独使用的切片。也许这样:

struct CountedBlockRef
{
  std::shared_ptr<Eigen::MatrixXd> matrix;
  Eigen::Index first_row, first_col, rows, cols;

  using block_type = Eigen::Block<
    Eigen::MatrixXd, Eigen::Dynamic, Eigen::Dynamic>;
  using const_block_type = Eigen::Block<
    const Eigen::MatrixXd, Eigen::Dynamic, Eigen::Dynamic>;

  CountedBlockRef() noexcept
  : matrix(), first_row(), first_col(), rows(), cols()
  {}
  CountedBlockRef(std::shared_ptr<Eigen::MatrixXd> matrix,
                  Eigen::Index first_row, Eigen::Index first_col,
                  Eigen::Index rows, Eigen::Index cols) noexcept
    : matrix(std::move(matrix)),
      first_row(first_row),
      first_col(first_col),
      rows(rows),
      cols(cols)
  {}
  block_type block() noexcept
  { return matrix->block(first_row, first_col, rows, cols); }

  const_block_type block() const noexcept
  {
    const Eigen::MatrixXd& matrix = *this->matrix;
    return matrix.block(first_row, first_col, rows, cols);
  }
};
int main()
{
  std::shared_ptr<Eigen::MatrixXd> matptr =
    std::make_shared<Eigen::MatrixXd>(Eigen::MatrixXd::Random(4, 5));
  CountedBlockRef aref(matptr, 0, 0, 2, 5);
  std::cout << *matptr << "\n\n" << aref.block() << '\n';
}

这样,即使在调整了矩阵和悬空指针大小后,参考文献也将保持有效。只有缩水仍然是一个威胁,但假设您与他们进行了编译,那会被断言所抓住。

That's what Eigen::Ref was built for. See the section "How to write generic, but non-templated function?"

Something like this:


void consume_matrix(const Eigen::Ref<const Eigen::MatrixXd>& in);
void produce_matrix(Eigen::Ref<Eigen::MatrixXd> out);


void foo()
{
    Eigen::MatrixXd matrix = ...;
    produce_matrix(matrix.middleRows(start, len));
    consume_matrix(matrix.leftCols(len));
}

Storing block references

Eigen doesn't come with a type that is well-suited to keep a "borrowed" block expression of a matrix. I wouldn't recommend Ref for this case because it is far too easy to make it point at temporary allocations which can easily lead to dangling pointers.

Ultimately, storing borrowed views is a fundamentally unsafe operation. But if you absolutely have to do it, I would use an Eigen::Map. At least that makes it clear you aren't owning the memory to which you refer. Something like this:

struct MatrixReference
{
  using map_type = Eigen::Map<
    Eigen::MatrixXd, Eigen::Unaligned, Eigen::OuterStride<> >;

  map_type matrix;

  template<class Derived>
  static map_type to_map(const Eigen::DenseBase<Derived>& matrix) noexcept
  {
    assert(matrix.innerStride() == 1);
    return map_type(const_cast<double*>(matrix.derived().data()),
                    matrix.rows(), matrix.cols(),
                    Eigen::OuterStride<>(matrix.outerStride()));
  }

  MatrixReference() noexcept
  : matrix(nullptr, 0, 0, Eigen::OuterStride<>(1))
  {}
  template<class Derived>
  explicit MatrixReference(const Eigen::DenseBase<Derived>& matrix) noexcept
    : matrix(to_map(matrix))
  {}
  MatrixReference(const MatrixReference&) = default;
  MatrixReference& operator=(const MatrixReference& o) noexcept
  {
    // placement-new because assignment would overwrite the content
    new (&matrix) map_type(o.matrix);
    return *this;
  }
};
int main()
{
  Eigen::MatrixXd mat = Eigen::MatrixXd::Random(4, 5);
  MatrixReference ref(mat.topRows(2));
  std::cout << mat << "\n\n" << ref.matrix << "\n\n";
}

A slightly safer option is to keep a shared_ptr to the matrix and store the information what slice you use separately. Maybe like this:

struct CountedBlockRef
{
  std::shared_ptr<Eigen::MatrixXd> matrix;
  Eigen::Index first_row, first_col, rows, cols;

  using block_type = Eigen::Block<
    Eigen::MatrixXd, Eigen::Dynamic, Eigen::Dynamic>;
  using const_block_type = Eigen::Block<
    const Eigen::MatrixXd, Eigen::Dynamic, Eigen::Dynamic>;

  CountedBlockRef() noexcept
  : matrix(), first_row(), first_col(), rows(), cols()
  {}
  CountedBlockRef(std::shared_ptr<Eigen::MatrixXd> matrix,
                  Eigen::Index first_row, Eigen::Index first_col,
                  Eigen::Index rows, Eigen::Index cols) noexcept
    : matrix(std::move(matrix)),
      first_row(first_row),
      first_col(first_col),
      rows(rows),
      cols(cols)
  {}
  block_type block() noexcept
  { return matrix->block(first_row, first_col, rows, cols); }

  const_block_type block() const noexcept
  {
    const Eigen::MatrixXd& matrix = *this->matrix;
    return matrix.block(first_row, first_col, rows, cols);
  }
};
int main()
{
  std::shared_ptr<Eigen::MatrixXd> matptr =
    std::make_shared<Eigen::MatrixXd>(Eigen::MatrixXd::Random(4, 5));
  CountedBlockRef aref(matptr, 0, 0, 2, 5);
  std::cout << *matptr << "\n\n" << aref.block() << '\n';
}

That way, the reference will remain valid even after resizing the matrix and dangling pointers are avoided. Only shrinking remains a threat but that is caught by assertions, assuming you compile with them.

指向切成薄片的特征矩阵

濫情▎り 2025-02-02 18:42:23

我和弹簧靴执行器有类似的现象。在我的情况下,问题是由于某种原因,CGROUP2内存控制器缺少。

jdk.internal.platform.cgroupsubsystemfactory#创建方法期望内存条目。 对其进行检查,

您可以使用$ cat /proc /cgroups

它应该包含一行以“内存”开头的

内核更新之后的问题。

I had a similar phenomenon with Spring Boot Actuator. In my case the problem was that the cgroup2 memory controller was missing for some reason.

The jdk.internal.platform.CgroupSubsystemFactory#create method expects a memory entry. You can check it with

$ cat /proc/cgroups

it should contain a row starting with "memory"

After a kernel update the problem was gone

java.lang.nullpoInterException:无法调用jdk.internal.platform.cgroupinfo.getmountpoint()因为“ AnyController”是无效的

濫情▎り 2025-02-02 17:31:38

Pricecheckicon需要以JSX形式使用。

更改:

<div>{PriceCheckIcon}</div>

<PriceCheckIcon />

PriceCheckIcon needs to be used in JSX form.

Change:

<div>{PriceCheckIcon}</div>

to

<PriceCheckIcon />

无法在反应三元条件下呈现MUI图标

濫情▎り 2025-02-02 15:46:07

这是一个错误,说明它在锡上的作用。 H5标签不应在段落标签中使用。他们表示不同的文字。您应该做一些类似的事情。

<div>
   <p><strong>Ans:</strong> The technology we use to build a web application first depends on the project and then everything else. Generally node.js is good for applications that require a persistent connection from the client to the server. Using Node.js can be a great way to build real-time web applications where data will be exchanged quickly through the network. Mongodb is greate database to make web application. Monogo is greate choice if the application have services that you many user and who interact like blogs website. MongoDB is a general-purpose database used in various ways to support web applications in many different industries examples telecommunications, gaming, blog, finances, healthcare, and retail.</p>
   <h5>MongoDB use cases</h5>
   <ul>
     <li>Integrating large amounts of diverse data</li>
     <li>Describing complex data structures that evolve</li>
     <li>Delivering data in high-performance applications</li>
     <li>Supporting hybrid and multi-cloud applications</li>
     <li>Supporting agile development and collaboration</li>
   </ul>
</div>

这将所有内容包装在DIV中而不是段落标签中,而是将其用于包装文本的第一个块。

This is an error that says what it does on the tin. h5 tags shouldn't be used within paragraph tags. They denote different styles of text. You should do something more akin this.

<div>
   <p><strong>Ans:</strong> The technology we use to build a web application first depends on the project and then everything else. Generally node.js is good for applications that require a persistent connection from the client to the server. Using Node.js can be a great way to build real-time web applications where data will be exchanged quickly through the network. Mongodb is greate database to make web application. Monogo is greate choice if the application have services that you many user and who interact like blogs website. MongoDB is a general-purpose database used in various ways to support web applications in many different industries examples telecommunications, gaming, blog, finances, healthcare, and retail.</p>
   <h5>MongoDB use cases</h5>
   <ul>
     <li>Integrating large amounts of diverse data</li>
     <li>Describing complex data structures that evolve</li>
     <li>Delivering data in high-performance applications</li>
     <li>Supporting hybrid and multi-cloud applications</li>
     <li>Supporting agile development and collaboration</li>
   </ul>
</div>

This wraps everything in a div instead of paragraph tags, which are instead used just to wrap the first block of text.

我如何解决此警告:验证的词(...):&lt; h5&gt;无法作为&lt; p&gt;的后代出现。

濫情▎り 2025-02-01 22:23:38

“列名”是您实际列名称的占位符。
例如,如果要删除一个名为“姓氏”的列,请使用:

df = df.drop("Surname",axis=1)

您在此处出现的错误清楚地表明,您的数据框中没有列名为“列名”。

"column name" is a placeholder for your actual column name.
For example, if you want to delete a column named "Surname", use:

df = df.drop("Surname",axis=1)

The error you have here is clearly stating that there is no column named "column name" in your dataframe.

从熊猫dataframe删除列的错误

濫情▎り 2025-02-01 16:22:19

有许多错误:

  1. char *data [];不是有效的。
  2. 这不是可扩展的。我们想要:char ** data = null;并使用realloc
  3. no 检查fgets ,因此它将无限 not 停止在EOF。
  4. 第二/后续的调用fgets obliterate 来自先前数据的数据。我们需要使用strdup保留数据。
  5. 没有 trafing newline的剥离。解决此问题的一种方法是将定系数从”“ ”更改为strtok “ \ n”
  6. 循环中的最终printf试图打印下一个元素,而不是当前的元素。这会产生垃圾,并且是UB(不确定的行为),并具有动态增长的阵列。
  7. PWD,主机名,用户名不属于MRE(最小可重复的示例)。

这是重构版本。

在下面的代码中,我使用预处理条件来表示旧代码:

#if 0
// old code
#else
// new code
#endif

#if 1
// new code
#endif

无论如何,这是代码:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifndef CWD_MAX_BUF
#define CWD_MAX_BUF 200
#endif

int
main(void)
{

    int i = 0;
    char input[150];

#if 0
    char name[256];
    char hostname[HOST_NAME_MAX];
    char username[LOGIN_NAME_MAX];
    char path[CWD_MAX_BUF];
#endif

#if 0
    char *data[];
#else
    char **data = NULL;
#endif

// NOTE/BUG: not part of an MRE
#if 0
    getcwd(path, CWD_MAX_BUF);
    gethostname(hostname, HOST_NAME_MAX);
    getlogin_r(username, LOGIN_NAME_MAX);
#endif

    for (;;) {
#if 0
        printf("[%s@%s %s] $ ", username, hostname, path);
#endif
// NOTE/BUG: you don't stop on EOF
#if 0
        fgets(input, 150, stdin);
#else
        if (fgets(input, sizeof(input), stdin) == NULL)
            break;
#endif

        char *token = strtok(input, " \n");

        while (token != NULL) {
// NOTE/BUG: we need to enlarge data dynamically
// NOTE/BUG: we have to use strdup -- otherwise, the subsequent fgets will
// obliterate the data from the prior line
#if 0
            data[i++] = token;
#else
            data = realloc(data,sizeof(*data) * (i + 1));
            data[i] = strdup(token);
#endif
            printf("TOKEN: %s\n", token);
            token = strtok(NULL, " \n");

// NOTE/BUG: tries to print one beyond the end of the actual data
#if 0
            printf("data[%i] = %s\n", i + 1, data[i]);
#else
            printf("data[%i] = %s\n", i, data[i]);
            i++;
#endif
        }
    }

    int count = i;
    for (i = 0;  i < count;  ++i)
        printf("final[%i] = %s\n",i,data[i]);

    return 0;
}

这是一些测试输入:

the quick brown fox jumps
over the lazy
dog

这是程序输出:

TOKEN: the
data[0] = the
TOKEN: quick
data[1] = quick
TOKEN: brown
data[2] = brown
TOKEN: fox
data[3] = fox
TOKEN: jumps
data[4] = jumps
TOKEN: over
data[5] = over
TOKEN: the
data[6] = the
TOKEN: lazy
data[7] = lazy
TOKEN: dog
data[8] = dog
final[0] = the
final[1] = quick
final[2] = brown
final[3] = fox
final[4] = jumps
final[5] = over
final[6] = the
final[7] = lazy
final[8] = dog

There are a number of bugs:

  1. char *data[]; is not valid.
  2. It isn't extensible. We want: char **data = NULL; and to use realloc
  3. There is no check for the return value of fgets, so it will loop infinitely and not stop at EOF.
  4. The second/subsequent calls to fgets obliterate the data from prior ones. We need to preserve the data using strdup.
  5. There is no stripping of the trailing newline. One way to fix this is to change the delimiters to strtok from " " to " \n".
  6. The final printf in the loop tries to print the next element rather than the current one. This produces garbage and is UB (undefined behavior) with a dynamically growing array.
  7. The pwd, hostname, username isn't part of an MRE (minimal reproducible example).

Here is a refactored version.

In the code below, I've used preprocessor conditionals to denote old vs new code:

#if 0
// old code
#else
// new code
#endif

#if 1
// new code
#endif

Anyway, here is the code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifndef CWD_MAX_BUF
#define CWD_MAX_BUF 200
#endif

int
main(void)
{

    int i = 0;
    char input[150];

#if 0
    char name[256];
    char hostname[HOST_NAME_MAX];
    char username[LOGIN_NAME_MAX];
    char path[CWD_MAX_BUF];
#endif

#if 0
    char *data[];
#else
    char **data = NULL;
#endif

// NOTE/BUG: not part of an MRE
#if 0
    getcwd(path, CWD_MAX_BUF);
    gethostname(hostname, HOST_NAME_MAX);
    getlogin_r(username, LOGIN_NAME_MAX);
#endif

    for (;;) {
#if 0
        printf("[%s@%s %s] $ ", username, hostname, path);
#endif
// NOTE/BUG: you don't stop on EOF
#if 0
        fgets(input, 150, stdin);
#else
        if (fgets(input, sizeof(input), stdin) == NULL)
            break;
#endif

        char *token = strtok(input, " \n");

        while (token != NULL) {
// NOTE/BUG: we need to enlarge data dynamically
// NOTE/BUG: we have to use strdup -- otherwise, the subsequent fgets will
// obliterate the data from the prior line
#if 0
            data[i++] = token;
#else
            data = realloc(data,sizeof(*data) * (i + 1));
            data[i] = strdup(token);
#endif
            printf("TOKEN: %s\n", token);
            token = strtok(NULL, " \n");

// NOTE/BUG: tries to print one beyond the end of the actual data
#if 0
            printf("data[%i] = %s\n", i + 1, data[i]);
#else
            printf("data[%i] = %s\n", i, data[i]);
            i++;
#endif
        }
    }

    int count = i;
    for (i = 0;  i < count;  ++i)
        printf("final[%i] = %s\n",i,data[i]);

    return 0;
}

Here is some test input:

the quick brown fox jumps
over the lazy
dog

Here is the program output:

TOKEN: the
data[0] = the
TOKEN: quick
data[1] = quick
TOKEN: brown
data[2] = brown
TOKEN: fox
data[3] = fox
TOKEN: jumps
data[4] = jumps
TOKEN: over
data[5] = over
TOKEN: the
data[6] = the
TOKEN: lazy
data[7] = lazy
TOKEN: dog
data[8] = dog
final[0] = the
final[1] = quick
final[2] = brown
final[3] = fox
final[4] = jumps
final[5] = over
final[6] = the
final[7] = lazy
final[8] = dog

获取错误&#x27;警告:分配给&#x2018; char&#x2019;从&#x2018; char *&#x2019;从指针中制作整数,而无需铸造&#x27;

濫情▎り 2025-02-01 16:03:49

所以,我想如何用USEMEMO替换usecallback
示例?

usecallback挂钩返回一个回忆的回调函数,该函数传递给了它,而usememo hook hook hook接收函数回调并返回记忆的值。

来自

usecallback(fn,deps)等效于usememo(()=&gt; fn,deps)

以下是等效的实现:

  1. usecallback

      const nameHandler = usecallback(()=&gt; {
      console.log(“真正的瘦插孔”);
    },[]);
    ...
    &lt; child name = {nameHandler} /&gt;
     
  2. usememo

      const nameHandler = usememo(()=&gt;()=&gt; {
      console.log(“真正的瘦插孔”);
    },[]);
    ...
    &lt; child name = {nameHandler} /&gt;
     

usememo挂钩正在接听 返回 的函数,该函数被用作调用,儿童组成部分。

并不清楚为什么您想这样做。 usecallback挂钩是要记住传递给儿童组件的回调时要使用的预期挂钩。与usememo版本中使用的“双重”函数相比,它也更清晰,更容易阅读。我建议坚持使用代码的usecallback版本。

So, I how am I suppose to replace useCallback with useMemo in this
example?

The useCallback hook returns a memoized callback function that is passed to it whereas the useMemo hook takes a function callback and returns a memoized value.

From the useCallback docs:

useCallback(fn, deps) is equivalent to useMemo(() => fn, deps).

The following are equivalent implementations:

  1. useCallback

    const nameHandler = useCallback(() => {
      console.log('Really Skinny Jack');
    }, []);
    ...
    <Child name={nameHandler} />
    
  2. useMemo

    const nameHandler = useMemo(() => () => {
      console.log('Really Skinny Jack');
    }, []);
    ...
    <Child name={nameHandler} />
    

The useMemo hook is taking a callback that returns a function that is being used and passed as a callback to a child component.

It isn't really clear at all why you would want to do this though. The useCallback hook is the intended hook to be used when you want to memoize a callback that is passed to children components. It's also a lot clearer and easier to read than the "double" function that is used in the useMemo version. I suggest sticking to the useCallback version of your code.

React-如何用UseMemo替换Uusecallback挂钩?

濫情▎り 2025-02-01 15:09:07

我从index.html中评论了&lt; base href =“/”&gt;,并且我的应用在服务器上显示。

然后我更改了outputpath angular.json不包括子域:“ outputpath”:“ dist”,

我还将publicfirebase.json中设置为 include subdomain:“ public”:“ dist/en-en-us” ,

为什么在angular.jsonfirebase.json中的不同设置?在这些更改之前,我将angular.json设置为“ outputpath”:“ dist/language-two13”,。结果是ng构建将我的Angular Project转移到dist/language-two13/en-us中。通过更改此设置,我摆脱了一个子域。

在浏览器中,URL中都不出现子域。

en-us子域来自我不知道的。我正在为I18N使用Cransloco,但是通过cransporco-root.module.ts我看到enes作为我项目的语言,不是en-us。我搜索了整个应用程序,只找到了en-us的几个实例,仅在将其纠正为en的代码中,并且从未在会影响转介剂的设置中进行。

我尝试将Crans上的默认语言从en转换为es。 Nada Cambios ...没有变化。

我尝试在app.module.ts中评论Clressoco,但Angular不会编译。

我尝试将文件从dist/en-us/转移到dist,删除en-us文件夹,更改firebase.json to “ public”:“ dist”,和评论&lt; base href =“/”&gt;返回index.html,并部署到Firebase托管。这很好。

总之,angular.json设置为无子域的transpile,但是en-us子域被神奇地插入,因此我设置了firebase.json 纠正这种怪异的行为。

我的帽子是整天处理这些事情的开发人员专业人士!

I commented out <base href="/"> from index.html and my app displays on the server.

And I changed the outputPath in angular.json to not include the subdomain: "outputPath": "dist",.

I also changed the public setting in firebase.json to include the subdomain: "public": "dist/en-US",.

Why the different settings in angular.json and firebase.json? Before these changes, I had angular.json set to "outputPath": "dist/language-two13",. The result was that ng build transpiled my Angular project into dist/language-two13/en-US. By changing this setting I got rid of one subdomain.

In the browser neither subdomain appeared in the URL.

Where the en-US subdomain is coming from I have no idea. I'm using Transloco for i18n but searching through transloco-root.module.ts I see en and es as the languages of my project, not en-US. I searched my entire app and found only a few instances of en-US, only in code that corrects this to en, and never in settings that would affect the transpiler.

I tried switching the default language of Transloco from en to es. Nada cambios...no changes.

I tried commenting out Transloco in app.module.ts but Angular won't compile.

I tried moving my files from dist/en-US/ to dist, removing the en-US folder, changing firebase.json to "public": "dist", and commenting <base href="/"> back into index.html, and deploying to Firebase Hosting. This works fine.

In conclusion, angular.json is set to transpile without a subdomain, but the en-US subdomain is magically getting inserted, so I set firebase.json to correct for this weird behavior.

My hat is off to dev-ops professionals who deal with this stuff all day!

无法加载模块脚本:预期一个JavaScript模块脚本,但服务器以“ text/html”的MIME类型响应

濫情▎り 2025-02-01 11:11:48

在0.14之前,不是为加载类型加载的图像创建摘要。

应固定在0.14中

Before 0.14, digests are not created for images loaded with kind load.

Should be fixed in 0.14
https://github.com/kubernetes-sigs/kind/issues/2734

crictl映像 - 消化不动在类似节点中不显示摘要

濫情▎り 2025-02-01 11:04:51

我设法弄清楚了如何做到这一点,我真的很愚蠢,不要注意到它,但我只能使用广告系列。

i managed to figure out how to do this and it was really dumb of me not to notice it but i can just use campaign.name in the form call

如何从表格上的响应中保存活动名称

濫情▎り 2025-02-01 07:53:28

您可以组合 如果值不正确(或真相,无论您需要什么逻辑),则可以将一个额外的处理程序抛出。

await Promise.any(
  promises.map(promise => promise.then(
    (result) => {
      if (!result) throw new Error(); // Make this reject
    }
  ))
);
// will reject if all promises reject

You can combine Promise.any with an additional handler that throws if the value isn't true (or truthy, whatever logic you need).

await Promise.any(
  promises.map(promise => promise.then(
    (result) => {
      if (!result) throw new Error(); // Make this reject
    }
  ))
);
// will reject if all promises reject

JavaScript中是否有类似于数组的承诺功能?

濫情▎り 2025-02-01 06:46:48

Chrome.tabs.update的回调几乎立即运行,因此随后的SendMessage在新URL导航之前运行,即在创建页面之前和内容脚本运行之前。

有几种解决方案。

1。使用chrome.storage.Local。

背景脚本:

chrome.omnibox.onInputEntered.addListener(async text => {
  await chrome.storage.local.set({text});
  await chrome.tabs.update({ url: 'http://www.asknoam.com' });
});

内容脚本:

chrome.storage.local.get('text', ({text}) => {
  process(text);
  chrome.storage.local.remove('text');
});
chrome.storage.onChanged.addListener(changes => {
  if (changes.text) process(changes.text.newValue);
});

subtest.json:

  "permissions": ["storage"]

2。等待标签加载

背景脚本:

chrome.omnibox.onInputEntered.addListener(async text => {
  const tab = await chrome.tabs.update({ url: 'http://www.asknoam.com' });
  chrome.tabs.onUpdated.addListener(function onUpd(tabId, info) {
    if (tabId === tab.id && info.status === 'complete') {
      chrome.tabs.onUpdated.removeListener(onUpd);
      chrome.tabs.sendMessage(tabId, text);
    }
  });
});

内容脚本:

chrome.runtime.onMessage.addListener(msg => {
  sendResponse('bar');
  // use msg
  // ........
});

The callback of chrome.tabs.update runs almost immediately, so the subsequent sendMessage runs before the new URL is navigated i.e. before the page is created and before the content script runs.

There are several solutions.

1. Use chrome.storage.local.

background script:

chrome.omnibox.onInputEntered.addListener(async text => {
  await chrome.storage.local.set({text});
  await chrome.tabs.update({ url: 'http://www.asknoam.com' });
});

content script:

chrome.storage.local.get('text', ({text}) => {
  process(text);
  chrome.storage.local.remove('text');
});
chrome.storage.onChanged.addListener(changes => {
  if (changes.text) process(changes.text.newValue);
});

manifest.json:

  "permissions": ["storage"]

2. Wait for the tab to load

background script:

chrome.omnibox.onInputEntered.addListener(async text => {
  const tab = await chrome.tabs.update({ url: 'http://www.asknoam.com' });
  chrome.tabs.onUpdated.addListener(function onUpd(tabId, info) {
    if (tabId === tab.id && info.status === 'complete') {
      chrome.tabs.onUpdated.removeListener(onUpd);
      chrome.tabs.sendMessage(tabId, text);
    }
  });
});

content script:

chrome.runtime.onMessage.addListener(msg => {
  sendResponse('bar');
  // use msg
  // ........
});

从空content.js脚本中获取响应。我在做什么错?

濫情▎り 2025-02-01 05:53:56

然后尝试垃圾箱:

pip3 install ta-lib-bin

Then try bin:

pip3 install ta-lib-bin

为什么要为ta-lib(setup.py)建造轮子。花很长时间?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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