痴情

文章 评论 浏览 30

痴情 2025-01-28 05:33:13

尝试在软件包的“分辨率”部分中添加“@types/react”

。 /react“版本:”*。
引用 *就像大多数肯定库的图书馆一样。不确定为什么这解决了我的问题。

"resolutions": {
    "@types/react": "17.0.38"
},

希望这会有所帮助。

try adding "@types/react" in the "resolutions" section of your package.json

this fixed my problem cause the dependencies of "@types/react-dom" on my package.lock.json is referencing "@types/react" version:"*".
Referencing * was like most of DefinitelyTyped libraries do it. Not really sure why this fixed my issue.

"resolutions": {
    "@types/react": "17.0.38"
},

Hope this helps.

其实例类型' browserrouter'不是有效的JSX元素

痴情 2025-01-28 03:05:15

我个人最喜欢的是xcopy,您可以使用这样的使用:

xcopy /F *.txt "C:\Program Files\"

/f非常有用,因为它显示了您的文件如何复制,类似:

C:\Temp_Folder\.Net_Version.txt -> C:\Program Files\.Net_Version.txt
C:\Temp_Folder\1.txt -> C:\Program Files\1.txt
C:\Temp_Folder\conf.conf.txt -> C:\Program Files\conf.conf.txt
C:\Temp_Folder\DLL_List.txt -> C:\Program Files\DLL_List.txt
C:\Temp_Folder\DLL_List_gekuist.txt -> C:\Program Files\DLL_List_gekuist.txt
C:\Temp_Folder\DNA.txt -> C:\Program Files\DNA.txt

请注意<<代码> c:\ program文件\ 是一个受保护的目录,您需要执行副本的管理员权限(将xcopy命令放在batchfile中并以管理员的速度启动(右键单击) ):

“在此处输入图像描述”

My personal favourite is xcopy, you can use is like this:

xcopy /F *.txt "C:\Program Files\"

The /F is very useful because it shows you how your files get copied, something like:

C:\Temp_Folder\.Net_Version.txt -> C:\Program Files\.Net_Version.txt
C:\Temp_Folder\1.txt -> C:\Program Files\1.txt
C:\Temp_Folder\conf.conf.txt -> C:\Program Files\conf.conf.txt
C:\Temp_Folder\DLL_List.txt -> C:\Program Files\DLL_List.txt
C:\Temp_Folder\DLL_List_gekuist.txt -> C:\Program Files\DLL_List_gekuist.txt
C:\Temp_Folder\DNA.txt -> C:\Program Files\DNA.txt

Be aware that C:\Program Files\ is a protected directory, you'll need administrator rights for performing the copy (put the xcopy command in a batchfile and launch it as administrator (right click)):

enter image description here

需要使用批量放置文本文件

痴情 2025-01-27 20:56:05

您可以计算参数和缓冲区的数量。
然后尝试将它们与元素大小相乘,您将具有所有参数的大小。

model = models.resnet18()
param_size = 0
buffer_size = 0
for param in model.parameters():
    param_size += param.nelement() * param.element_size()

for buffer in model.buffers():
    buffer_size += buffer.nelement() * buffer.element_size()

size_all_mb = (param_size + buffer_size) / 1024**2
print('Size: {:.3f} MB'.format(size_all_mb))

它将打印:

大小:361.209 MB

You are able to calculate the number of parameters and buffers.
Then try to multiply them with the element size and you will have the size of all parameters.

model = models.resnet18()
param_size = 0
buffer_size = 0
for param in model.parameters():
    param_size += param.nelement() * param.element_size()

for buffer in model.buffers():
    buffer_size += buffer.nelement() * buffer.element_size()

size_all_mb = (param_size + buffer_size) / 1024**2
print('Size: {:.3f} MB'.format(size_all_mb))

And it will print:

Size: 361.209 MB

如何找到深度学习模型的大小?

痴情 2025-01-27 03:41:44

总而言之,这里不会有一个简单的解决方案——Cypress 的 get 命令具有断言,因此您无法轻松捕获或吃掉这些异常。如果您尝试获取不存在的元素,Cypress 的断言将会失败。不幸的是,最好的情况是每个断言都有确定性行为。

有关 Cypress 为何这样做的更多信息

我认为这样做的最佳情况是编写自定义 Chai 断言,但我没有任何这样做的经验。 这是 Chai 的相关文档。

如果您想简化代码,但又知道要简化哪些内容元素不应该存在以及哪些元素不应该可见,您可以编写自定义命令来处理该问题。

Cypress.Commands.add('notExistOrNotVisible', (selector, isNotExist) => {
  cy.get(selector).should(isNotExist ? 'not.exist' : 'not.be.visible');
});

cy.notExistOrNotVisible('foo', true); // asserts that `foo` does not exist
cy.notExistOrNotVisible('bar', false); // asserts that `bar` is not visible

我任意地认为不存在积极的情况,但你可以切换它和应该中的逻辑。

The tl;dr is that there isn't going to be a simple solution here -- Cypress' get command has assertions, so you can't easily catch or eat those exceptions. If you try to get an element that doesn't exist, Cypress will have a failed assertion. Unfortunately, the best case would be to have deterministic behavior for each assertion.

More info on why Cypress behaves this way here.

I think your best case for doing this would be to write a custom Chai assertion, but I don't have any experience in doing anything like that. Here is Chai's documentation on doing so.

If you wanted to simplify your code, but knew which elements should not exist and which elements should not be visible, you could write a custom command to handle that.

Cypress.Commands.add('notExistOrNotVisible', (selector, isNotExist) => {
  cy.get(selector).should(isNotExist ? 'not.exist' : 'not.be.visible');
});

cy.notExistOrNotVisible('foo', true); // asserts that `foo` does not exist
cy.notExistOrNotVisible('bar', false); // asserts that `bar` is not visible

I arbitrarily made not exist the positive case, but you could switch that and the logic in the should.

柏树不应。是否存在。

痴情 2025-01-27 02:31:43

当我想注入 IRequestClient<> 时,我遇到了同样的问题,
根据文档,不需要配置,但您可以使用

可以使用任何有效消息类型的依赖注入来解析请求客户端,无需配置。默认情况下,请求消息已发布,并且只能由连接到消息代理的一个使用者/接收端点使用。

x.AddRequestClient<CheckOrderStatus>

但它只有在手动配置时才有效,或者即使您同时使用 Rabbit、InMemory,您也应该在配置后使用它。

services.AddMassTransit(x =>
{
    x.AddMessageScheduler(schedulerEndpoint);

    x.AddConsumers(assemblies);

    // Doesn`t work here :|
    x.AddRequestClient<AddComponentToMenuStructure>();

    if (Setting.General.MessageBroker == MessageBroker.RabbitMQ)
    {
        x.UsingRabbitMq((context, cfg) =>
        {
            cfg.Host(bpmsSetting.RabbitMq.Host, bpmsSetting.RabbitMq.VirtualPath, h =>
            {
                h.Username(bpmsSetting.RabbitMq.Username);
                h.Password(bpmsSetting.RabbitMq.Password);
                h.Heartbeat(TimeSpan.FromSeconds(5));
            });

            // More Config

            cfg.ConfigureEndpoints(context, new NameFormatter(bpmsSetting));
        });

    }
    else if (Setting.General.MessageBroker == MessageBroker.InMemory)
    {
         x.UsingInMemory((context, cfg) =>
            {
                // More Config
            
                cfg.ConfigureEndpoints(context, new 
NameFormatter(bpmsSetting));
            });
    }

    // Here
    x.AddRequestClient<AddComponentToMenuStructure>();
});

I had same issue when I want inject the IRequestClient<>,
Based on Docs there is no need for configuration but you could do that with

A request client can be resolved using dependency injection for any valid message type, no configuration is required. By default, request messages are published and should be consumed by only one consumer/receive endpoint connected to the message broker.

x.AddRequestClient<CheckOrderStatus>

but it does work only when config this manually, or even if you use both Rabbit, InMemory you should use this after configurations.

services.AddMassTransit(x =>
{
    x.AddMessageScheduler(schedulerEndpoint);

    x.AddConsumers(assemblies);

    // Doesn`t work here :|
    x.AddRequestClient<AddComponentToMenuStructure>();

    if (Setting.General.MessageBroker == MessageBroker.RabbitMQ)
    {
        x.UsingRabbitMq((context, cfg) =>
        {
            cfg.Host(bpmsSetting.RabbitMq.Host, bpmsSetting.RabbitMq.VirtualPath, h =>
            {
                h.Username(bpmsSetting.RabbitMq.Username);
                h.Password(bpmsSetting.RabbitMq.Password);
                h.Heartbeat(TimeSpan.FromSeconds(5));
            });

            // More Config

            cfg.ConfigureEndpoints(context, new NameFormatter(bpmsSetting));
        });

    }
    else if (Setting.General.MessageBroker == MessageBroker.InMemory)
    {
         x.UsingInMemory((context, cfg) =>
            {
                // More Config
            
                cfg.ConfigureEndpoints(context, new 
NameFormatter(bpmsSetting));
            });
    }

    // Here
    x.AddRequestClient<AddComponentToMenuStructure>();
});

MassTransit 无法使用 IRequestClient - 依赖项注入问题

痴情 2025-01-26 17:51:40

感谢您的反馈。我想我对我的问题找到了决定。

select tt."repeat", tt.deviation_id, min(tt.week_number), max(tt.week_number)
from (
select tt.*
from (
    select tt.*, count(tt."repeat")over(partition by tt."repeat") as "count"
    from (
        select tt.deviation_id, tt.week_number, --сount(tt.deviation_id)
            row_number() over(partition by tt.deviation_id order by tt.week_number)-tt.week_number as "repeat"
        from public.tasks_task tt 
        where tt."year" =2022 and tt.orgunit_id =3000 and tt.deviation_id in ('262','264'))tt)tt
where tt."count">1) tt
group by 1,2
order by 2,3

Thank you for feed back. I think i found a decision on my question.

select tt."repeat", tt.deviation_id, min(tt.week_number), max(tt.week_number)
from (
select tt.*
from (
    select tt.*, count(tt."repeat")over(partition by tt."repeat") as "count"
    from (
        select tt.deviation_id, tt.week_number, --сount(tt.deviation_id)
            row_number() over(partition by tt.deviation_id order by tt.week_number)-tt.week_number as "repeat"
        from public.tasks_task tt 
        where tt."year" =2022 and tt.orgunit_id =3000 and tt.deviation_id in ('262','264'))tt)tt
where tt."count">1) tt
group by 1,2
order by 2,3

按连续几周分组

痴情 2025-01-26 05:14:51

您可以让 Latex 在 table 环境的末尾添加您的注释:

\documentclass{article}

\begin{document}

\AddToHook{env/table/end}{some note}

\begin{table}
first table
\end{table}

\RemoveFromHook{env/table/end}

\begin{table}
second table
\end{table}

\end{document}

You could let latex add your note at the end of the table environment:

\documentclass{article}

\begin{document}

\AddToHook{env/table/end}{some note}

\begin{table}
first table
\end{table}

\RemoveFromHook{env/table/end}

\begin{table}
second table
\end{table}

\end{document}

如何从rable和没有表环境的R中导出回归表?

痴情 2025-01-26 04:03:14

有一个算法 std::merge 来自 < strong>C++17,当输入向量排序时非常容易使用,

下面是示例:

#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
    //DATA
    std::vector<int> v1{2,4,6,8};
    std::vector<int> v2{12,14,16,18};

    //MERGE
    std::vector<int> dst;
    std::merge(v1.begin(), v1.end(), v2.begin(), v2.end(), std::back_inserter(dst));

    //PRINT
    for(auto item:dst)
        std::cout<<item<<" ";

    return 0;
}

There is an algorithm std::merge from C++17, which is very easy to use when the input vectors are sorted,

Below is the example:

#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
    //DATA
    std::vector<int> v1{2,4,6,8};
    std::vector<int> v2{12,14,16,18};

    //MERGE
    std::vector<int> dst;
    std::merge(v1.begin(), v1.end(), v2.begin(), v2.end(), std::back_inserter(dst));

    //PRINT
    for(auto item:dst)
        std::cout<<item<<" ";

    return 0;
}

加入两个std ::向量

痴情 2025-01-26 02:21:15

这就是最终对我工作的原因

props.Information.get('message')

So this is what ended up working for me

props.Information.get('message')

如何在JS中的不变对象/地图中访问值?

痴情 2025-01-25 12:48:24

您可以使用Ajax加载整个页面,但它的数据不必要大。

您可以加载所需的零件:如果有一个名为“日历”的查询字符串或仅显示日历html的东西。
您每分钟左右提出要求“?日历”的请求。

该解决方案不是最好的,因为您返回普通的HTML数据。
您可以制作一个端点,该端点将使用日历数据返回JSON数据,然后将其解析为JS。

You can load the entire page using AJAX but its unnecessarily large amount of data.

You can just load the part you need: if there is a query string called 'calendar' or something you display only the calendar HTML.
And you make a request to '?calendar' every minute or so.

This solution is not the best because you return plain HTML data.
You could make an endpoint which returns JSON data with the calendar data and you parse it in JS.

使用 AJAX 从 PHP 重新加载页面的一部分

痴情 2025-01-25 07:38:48

l是您创建的对象。您应该调用函数f。

def f(n1: int, n2: int):
    if n1>n2:
        L=list(range(n2,n1+1))
        L.reverse()
    elif n1==n2:
        L=[n1]
    else:
        L=list(range(n1,n2+1))
        L.reverse()
    return L
f(2,5)

L is a object you have created.you should call the function f.

def f(n1: int, n2: int):
    if n1>n2:
        L=list(range(n2,n1+1))
        L.reverse()
    elif n1==n2:
        L=[n1]
    else:
        L=list(range(n1,n2+1))
        L.reverse()
    return L
f(2,5)

“列表”对象不可调用,Python 错误

痴情 2025-01-24 22:48:24

您不能导出默认,因为它是保留的关键字。
您可以用:

export { default as Test } from './test';

You cannot export default because it's a reserved keyword.
You could replace the line with :

export { default as Test } from './test';

ESLINT错误:&#x27;默认值&#x27;限制被用作出口名称

痴情 2025-01-24 19:31:45

第一部分是:

julia> using DataFrames, Random

julia> Random.seed!(1234);

julia> df = DataFrame(:num=>rand(0:10,20));

julia> df1 = combine(groupby(df, :num, sort=true), nrow)
10×2 DataFrame
 Row │ num    nrow
     │ Int64  Int64
─────┼──────────────
   1 │     0      1
   2 │     2      2
   3 │     3      2
   4 │     4      2
   5 │     5      1
   6 │     6      2
   7 │     7      2
   8 │     8      4
   9 │     9      1
  10 │    10      3

我不确定您在第二步中想要什么,但这里有两种使用 df1 或 df 实现第三步的方法:

julia> (sum(df1.nrow[df1.num .>= 9]) - sum(df1.nrow[df1.num .<= 6])) / sum(df1.nrow)
-0.3

julia> (count(>=(9), df.num) - count(<=(6), df.num)) / nrow(df)
-0.3

The first part is:

julia> using DataFrames, Random

julia> Random.seed!(1234);

julia> df = DataFrame(:num=>rand(0:10,20));

julia> df1 = combine(groupby(df, :num, sort=true), nrow)
10×2 DataFrame
 Row │ num    nrow
     │ Int64  Int64
─────┼──────────────
   1 │     0      1
   2 │     2      2
   3 │     3      2
   4 │     4      2
   5 │     5      1
   6 │     6      2
   7 │     7      2
   8 │     8      4
   9 │     9      1
  10 │    10      3

I was not sure what you wanted in the second step, but here are two ways to achieve the third step using either df1 or df:

julia> (sum(df1.nrow[df1.num .>= 9]) - sum(df1.nrow[df1.num .<= 6])) / sum(df1.nrow)
-0.3

julia> (count(>=(9), df.num) - count(<=(6), df.num)) / nrow(df)
-0.3

计数发生并用数据框进行计算

痴情 2025-01-24 14:54:40

在许多情况下,必须定位元素才能使 z-index 发挥作用。

事实上,将 position:relative 应用于问题中的元素可能会解决问题(但没有提供足够的代码来确定)。

实际上,position:fixedposition:absoluteposition:sticky也会启用z-index,但是这些值也会改变布局。使用 position:relative 布局不会受到干扰。

本质上,只要元素不是 position: static (默认设置),它就被视为已定位,并且 z-index 就可以工作。


对于“为什么 z-index 不起作用?”问题的许多答案都断言,z-index 仅适用于定位元素。从 CSS3 开始,这不再是事实。

弹性项目网格项 甚至可以使用 z-index位置静态时。

从规格来看:

4.3。弹性项目 Z 排序

Flex 项目的绘制与内联块完全相同,只是使用顺序修改的文档顺序来代替原始顺序
文档顺序和除 auto 之外的 z-index 值会创建堆叠上下文,即使 positionstatic。< /p>

5.4。 Z 轴排序:z-index 属性

网格项的绘制顺序与内联块完全相同,只不过顺序修改的文档顺序是
用于代替原始文档顺序,并且 auto 之外的 z-index 值会创建堆叠上下文,即使
位置静态

以下是 z-index 在非定位弹性项目上工作的演示:https://jsfiddle。净/m0wddwxs/

In many cases an element must be positioned for z-index to work.

Indeed, applying position: relative to the elements in the question would likely solve the problem (but there's not enough code provided to know for sure).

Actually, position: fixed, position: absolute and position: sticky will also enable z-index, but those values also change the layout. With position: relative the layout isn't disturbed.

Essentially, as long as the element isn't position: static (the default setting) it is considered positioned and z-index will work.


Many answers to "Why isn't z-index working?" questions assert that z-index only works on positioned elements. As of CSS3, this is no longer true.

Elements that are flex items or grid items can use z-index even when position is static.

From the specs:

4.3. Flex Item Z-Ordering

Flex items paint exactly the same as inline blocks, except that order-modified document order is used in place of raw
document order, and z-index values other than auto create a stacking context even if position is static.

5.4. Z-axis Ordering: the z-index property

The painting order of grid items is exactly the same as inline blocks, except that order-modified document order is
used in place of raw document order, and z-index values other than auto create a stacking context even if
position is static.

Here's a demonstration of z-index working on non-positioned flex items: https://jsfiddle.net/m0wddwxs/

为什么 z 索引不起作用?

痴情 2025-01-24 14:07:51
x = c(1,2,3,4,5,6,7,4,9.7,10,4,4,4,4,3,3,3,8,8,8,8,8,8,9.6,9.6,9.8,9.9,9.9)

library(data.table)
y <- rle(between(x, 9.5, 10))
# Run Length Encoding
# lengths: int [1:4] 8 2 13 5
# values : logi [1:4] FALSE TRUE FALSE TRUE

ifelse( 
  #check if laste sequence contains TRUE
  last(y$values), 
  #if so then find the start position of the last sequence
  length(x) - last(y$lengths), 
  #if not then
  "there is no such index" )

# [1] 23
x = c(1,2,3,4,5,6,7,4,9.7,10,4,4,4,4,3,3,3,8,8,8,8,8,8,9.6,9.6,9.8,9.9,9.9)

library(data.table)
y <- rle(between(x, 9.5, 10))
# Run Length Encoding
# lengths: int [1:4] 8 2 13 5
# values : logi [1:4] FALSE TRUE FALSE TRUE

ifelse( 
  #check if laste sequence contains TRUE
  last(y$values), 
  #if so then find the start position of the last sequence
  length(x) - last(y$lengths), 
  #if not then
  "there is no such index" )

# [1] 23

“停留时间”间隔

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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