死开点丶别碍眼

文章 评论 浏览 31

死开点丶别碍眼 2025-02-20 18:02:08

当我使用 debugprint 而不是打印显示所有文本。

rootbundle.loadstring 没有问题,但是打印命令有其限制。

When i used debugPrint instead of print all the text was shown.

There was no problem with rootBundle.loadString, but the print command has its limit.

rootbundle.loadstring不会读取文件中的整个文本

死开点丶别碍眼 2025-02-20 16:26:54

您正在尝试渲染故事,而不是复选框本身。为什么不直接导入复选框,而是使用故事args呢?

import * as React from 'react';
import { screen, render } from '@testing-library/react';
import AccountCheckbox from '../components/AccountCheckbox';
import { Default as AccountCheckboxStory } from '../../stories/AccountCheckbox.stories';

const renderCheckbox = () => {
  render(<AccountCheckbox {...AccountCheckboxStory.args} />);
}

describe('<AccountCheckbox />', () => {
  test('should display account information', () => {
    renderCheckbox();

    expect(screen.getByTestId('example-test-id')).toBeInTheDocument();
  });
});

您可能需要将路径调整到故事/AccountCheckbox,因为我不太确定您的目录结构是什么样的。

Update

从您的评论和链接中转到,似乎他们使用某种形式的组成功能来包装导出的故事并将其归还为组件。因此,在您的情况下,您不会这样做:

import React from 'react';
import { render, screen } from '@testing-library/react';
import { composeStories } from '@storybook/testing-react';

import * as stories from '../../stories/AccountCheckbox.stories';

const { Default: AccountCheckBoxDefault } = composeStories(stories);

test('renders profile page', async () => {
  render(<AccountCheckBoxDefault />);
  // ... some assertions here
});

describe('<AccountCheckbox />', () => {
  test('should display account information', () => {
    renderCheckbox();

    expect(screen.getByTestId('example-test-id')).toBeInTheDocument();
  });
});

我认为实际上不需要传递Args,因为故事本身应该使用这些args。

You're trying to render the Story, not the Checkbox itself. Why not import the checkbox directly, but use the story args too?

import * as React from 'react';
import { screen, render } from '@testing-library/react';
import AccountCheckbox from '../components/AccountCheckbox';
import { Default as AccountCheckboxStory } from '../../stories/AccountCheckbox.stories';

const renderCheckbox = () => {
  render(<AccountCheckbox {...AccountCheckboxStory.args} />);
}

describe('<AccountCheckbox />', () => {
  test('should display account information', () => {
    renderCheckbox();

    expect(screen.getByTestId('example-test-id')).toBeInTheDocument();
  });
});

You may need to adjust paths to the Story/AccountCheckbox as I'm not quite sure what your directory structure looks like.

Update

Going from your comment and the link, it seems that they are using some form of a compositional function to wrap the exported stories and return them as components. So in your case, would you not do this:

import React from 'react';
import { render, screen } from '@testing-library/react';
import { composeStories } from '@storybook/testing-react';

import * as stories from '../../stories/AccountCheckbox.stories';

const { Default: AccountCheckBoxDefault } = composeStories(stories);

test('renders profile page', async () => {
  render(<AccountCheckBoxDefault />);
  // ... some assertions here
});

describe('<AccountCheckbox />', () => {
  test('should display account information', () => {
    renderCheckbox();

    expect(screen.getByTestId('example-test-id')).toBeInTheDocument();
  });
});

I don't think it's actually necessary to pass in the args, as those args should be used by the story itself.

开玩笑的“属性类型”&#x27;不兼容”尝试使用Typescript使用故事书中的故事时出错

死开点丶别碍眼 2025-02-20 15:50:31

您所有的过程均进行相同的工作。
如果您有10个文件,您的所有进程都在同一10个文件上运行,那么您的锁(设置状态为处理)太慢了,到第一个过程设置了处理下一个过程的状态时,请通过新检查。 。

查找每个过程的文件,因此,如果您有100个文件和5个进程,1。处理处理1-20和2。进程手柄21-40,依此类推

All your processes are run the same work.
If you have 10 files all your processes are running on the same 10 files, your lock (setting status to processing) is too slow, and by the time the first process is setting the status to processing the next process is passed the if new check.

Look in to split up the file for each process, so if you have 100 files and 5 processes, 1. process handles 1-20 and 2. process handles 21 - 40 and so on

与文件和DB一起在Python中进行并行工作的正确方法?

死开点丶别碍眼 2025-02-20 05:34:23

我猜您有双启动的Ubuntu和Windows。如果是这种情况,您可能会在grub中获得ACPI。尝试以下操作:

  1. 启动您的PC,然后进入grub屏幕以在Windows和Ubuntu之间进行选择,
  2. 然后按向下/向上,以便到达Ubuntu Line,并在键盘上按字母“ E”。
  3. 看“安静的飞溅acpi = off”线。
  4. 如果您没有“ ACPI = OFF”,请忽略。如果您确实去下一步。
  5. 删除“ ACPI = OFF”,然后按Ctrl + X
  6. 启动到Ubuntu打开终端并键入“ sudo vim/etc/default/grub”。
  7. 查找GRUB_CMDLINE_LINUX_DEFAULT =“ QUIET SPLASH ACPI = OFF”
  8. 再次删除ACPI = OFF。然后点击ESC,然后:,然后键入WQ,然后点击Enter。
  9. Sudo Update-Grub

希望这会有所帮助!

I am guessing you have dual booted ubuntu and windows. If this is the case you might have acpi off in grub. Try this:

  1. Start your pc and get to grub screen to select between windows and ubuntu
  2. Press down/up to get to ubuntu line and press letter 'e' on keyboard.
  3. Look "quiet splash acpi=off" line.
  4. If you do not have "acpi=off", please disregard. If you do go to next step.
  5. Remove "acpi=off", and press ctrl + x
  6. Once you are booted into ubuntu open a terminal and type "sudo vim /etc/default/grub".
  7. Look for GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi=off"
  8. Once again remove acpi=off. Hit esc, then :, then type wq, and hit enter.
  9. sudo update-grub

Hope this helps!

SGX禁用BIOS Ubuntu ACPI错误22.04 LTS

死开点丶别碍眼 2025-02-20 03:25:43
gen wanted = inlist(trim(BRANSCH), "10.112", "10.120", "10.130", " 10.390", "10.520", "10.710", "10.721", "10.822", "10.840", "10.850") | inlist(trim(BRANSCH),"10.890", "11.020", "11.030" "12.000") 

是一种选择。参见 https://www.stata.com/manuals/manuals/fnprogrammmingions.pdf 遵守10个字符串的极限。

这是另一个:


gen wanted = 0 

foreach s in 10.112 10.120 10.130 10.390 10.520 10.710 10.721 10.822 10.840 10.850 10.890 11.020 11.030 12.000 { 
    replace wanted = 1 if trim(BRANSCH) == "`s'" 
}

既不是特别直接的,也不是encodedestring

gen wanted = inlist(trim(BRANSCH), "10.112", "10.120", "10.130", " 10.390", "10.520", "10.710", "10.721", "10.822", "10.840", "10.850") | inlist(trim(BRANSCH),"10.890", "11.020", "11.030" "12.000") 

is one alternative. See https://www.stata.com/manuals/fnprogrammingfunctions.pdf for the limit of 10 strings obeyed in that.

And here is another:


gen wanted = 0 

foreach s in 10.112 10.120 10.130 10.390 10.520 10.710 10.721 10.822 10.840 10.850 10.890 11.020 11.030 12.000 { 
    replace wanted = 1 if trim(BRANSCH) == "`s'" 
}

Neither is especially direct, but nor is playing around with encode or destring.

组A字符串变量/创建分类变量

死开点丶别碍眼 2025-02-20 01:08:57

要安装gnome扩展名而无需重新加载gnome会话,您必须运行:

busctl --user call org.gnome.Shell.Extensions /org/gnome/Shell/Extensions org.gnome.Shell.Extensions InstallRemoteExtension s ${EXTENSION_ID}

dbus-send --session --type=method_call --print-reply --dest=org.gnome.Shell.Extensions /org/gnome/Shell/Extensions org.gnome.Shell.Extensions.InstallRemoteExtension string:${EXTENSION_ID}

To install gnome extensions without reloading the gnome session, you have to run:

busctl --user call org.gnome.Shell.Extensions /org/gnome/Shell/Extensions org.gnome.Shell.Extensions InstallRemoteExtension s ${EXTENSION_ID}

or,

dbus-send --session --type=method_call --print-reply --dest=org.gnome.Shell.Extensions /org/gnome/Shell/Extensions org.gnome.Shell.Extensions.InstallRemoteExtension string:${EXTENSION_ID}

GNOME-BROWSER扩展和Chrome-gnome-shell负载扩展如何而无需重新加载gnome会话

死开点丶别碍眼 2025-02-19 19:05:03

您实际上是否认为有人会拖延您发布的所有代码?您真的觉得有必要带一个大型木制俱乐部,然后将海报击中果肉,然后痛苦和痛苦地将其送往医院,以阅读所有代码?

根本不清楚该代码应该做什么,但是更糟糕的是,您的问题似乎根本没有遵循发布的代码,对吗?

使用按钮在“车辆1”和“车辆2”列中的数据之间切换内容。

在哪里?我看不到任何标记或一些称为车辆1的列。

此外,甚至还没有清楚为什么您有所有这些变量和代码?做什么的?

因此,您当然可以加载数据表,然后将其发送给GridView。

因此,说我们有一个网格视图:

        <asp:GridView ID="GHotels" runat="server" CssClass="table" AutoGenerateColumns="false"
            width="45%" DataKeyNames="ID" >
            <Columns>
                <asp:BoundField DataField="FirstName" HeaderText="FirstName"  />
                <asp:BoundField DataField="LastName" HeaderText="LastName"    />
                <asp:BoundField DataField="HotelName" HeaderText="HotelName"  />
                <asp:BoundField DataField="Description" HeaderText="Description" ItemStyle-Width="270" />

                <asp:TemplateField HeaderText = "Copy hotel" ItemStyle-HorizontalAlign ="Center" >
                    <ItemTemplate>
                    <asp:Button ID="cmdRow" runat="server" Text="Copy hotel" 
                       CssClass="btn"  OnClick="cmdRow_Click" />
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:TemplateField HeaderText = "copy of Hotel name" >
                    <ItemTemplate>
                        <asp:Label ID="txtHotelC" runat="server" Width="140px"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>

            </Columns>
        </asp:GridView>

因此,可以这样说:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            LoadData();
    }

    void LoadData()
    {
        using (SqlConnection conn = new SqlConnection(Properties.Settings.Default.TEST4))
        {
            string strSQL = 
                "SELECT * FROM tblHotelsA ORDER BY HotelName";
            using (SqlCommand cmdSQL = new SqlCommand(strSQL, conn))
            {
                DataTable rstData = new DataTable();
                conn.Open();
                rstData.Load(cmdSQL.ExecuteReader());
                GHotels.DataSource = rstData;
                GHotels.DataBind();
            }
        }
    }

<

a href =“ https://i.sstatic.net/haidb.png” noreferrer”> “在此处输入图像说明”

因此,现在让我们将一个按钮行汇总到我们拥有的一个按钮行,然后说将酒店名称复制到最后一列。这将使您了解如何在GV中单击的一行操作。

因此,我们可以使用此代码进行按钮单击:

    protected void cmdRow_Click(object sender, EventArgs e)
    {
        Button btn = sender as Button;
        GridViewRow gRow = btn.NamingContainer as GridViewRow;

        string sHotelName = gRow.Cells[2].Text;

        // now copy this value over to the last colum - the label

        Label tHotel = gRow.FindControl("txtHotelC") as Label;

        tHotel.Text = sHotelName;

        // addtional information we can use aboput this row click

        Debug.Print("Row index click = " + gRow.RowIndex);
        Debug.Print("ID (data keys) = " + GHotels.DataKeys[gRow.RowIndex]["ID"].ToString());
        Debug.Print("FirstName = " + gRow.Cells[0].Text);
        Debug.Print("Last Name = " + gRow.Cells[1].Text);
    }

当我说单击第二行时,网格现在显示以下显示:

”输入图像描述在此处“

和输出窗口显示我们有关该行的其他信息,请单击问题:

“在此处输入图像描述”

所以,上面是Nutshell显示了如何获取行信息。显示您如何在一行上进行某些操作。

因此,从上方,您应该能够建立在尝试在一行中工作的操作。

一旦您丢弃了您发布的大量代码(以节省世界贫困),我们就可以使该代码用于行单击。完成后,我们可以考虑将该代码运行并在JavaScript中运行和操作客户端。

但是,我们首先需要摆脱您发布的大量代码 - 您不需要它,然后我们就可以提出一个问题 - 一个基于试图滥用和殴打海报的基于俱乐部和俱乐部,您发布的代码的船只船是没有意义的,不需要的。换句话说?尽量不要对愿意为您提供帮助的堆栈中的人们表现出如此巨大的仇恨和厌恶。

do you actually think someone going to trudge through all that code you posted? Do you really feel it necessary to take a big wooden club, and beat the posters here into a pulp and send them to the hospital in pain and suffering to read all of that code?

It not at all clear what all that code is supposed to do, but worse your question does not seem to follow the posted code at all either, does it?

to use the button to switch the content in "What Stays" Column between the data in "Vehicle 1" and "Vehicle 2" column.

Where? I don't see any markup or some column called Vehicle 1.

Further more, it not even close to clear why you have all those variables and code? What for?

So, you can certainly load up a data table, and then send that to say a Gridview.

So, say we have this grid view:

        <asp:GridView ID="GHotels" runat="server" CssClass="table" AutoGenerateColumns="false"
            width="45%" DataKeyNames="ID" >
            <Columns>
                <asp:BoundField DataField="FirstName" HeaderText="FirstName"  />
                <asp:BoundField DataField="LastName" HeaderText="LastName"    />
                <asp:BoundField DataField="HotelName" HeaderText="HotelName"  />
                <asp:BoundField DataField="Description" HeaderText="Description" ItemStyle-Width="270" />

                <asp:TemplateField HeaderText = "Copy hotel" ItemStyle-HorizontalAlign ="Center" >
                    <ItemTemplate>
                    <asp:Button ID="cmdRow" runat="server" Text="Copy hotel" 
                       CssClass="btn"  OnClick="cmdRow_Click" />
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:TemplateField HeaderText = "copy of Hotel name" >
                    <ItemTemplate>
                        <asp:Label ID="txtHotelC" runat="server" Width="140px"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>

            </Columns>
        </asp:GridView>

So, code to load the grid can be say this:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            LoadData();
    }

    void LoadData()
    {
        using (SqlConnection conn = new SqlConnection(Properties.Settings.Default.TEST4))
        {
            string strSQL = 
                "SELECT * FROM tblHotelsA ORDER BY HotelName";
            using (SqlCommand cmdSQL = new SqlCommand(strSQL, conn))
            {
                DataTable rstData = new DataTable();
                conn.Open();
                rstData.Load(cmdSQL.ExecuteReader());
                GHotels.DataSource = rstData;
                GHotels.DataBind();
            }
        }
    }

And now we have this:

enter image description here

So, now lets wire up the one button row click we have, and say copy the hotel name over to the last column. This will give you an idea as to how to operate on one row you click on in the GV.

So, we can have this code for the button click:

    protected void cmdRow_Click(object sender, EventArgs e)
    {
        Button btn = sender as Button;
        GridViewRow gRow = btn.NamingContainer as GridViewRow;

        string sHotelName = gRow.Cells[2].Text;

        // now copy this value over to the last colum - the label

        Label tHotel = gRow.FindControl("txtHotelC") as Label;

        tHotel.Text = sHotelName;

        // addtional information we can use aboput this row click

        Debug.Print("Row index click = " + gRow.RowIndex);
        Debug.Print("ID (data keys) = " + GHotels.DataKeys[gRow.RowIndex]["ID"].ToString());
        Debug.Print("FirstName = " + gRow.Cells[0].Text);
        Debug.Print("Last Name = " + gRow.Cells[1].Text);
    }

When I say click on the 2nd row, then the grid now shows this:

enter image description here

And the output window shows our additional information about the row click in question:

enter image description here

So, above in a nutshell shows how you can get the row information. Shows how you can have some operation occur on and againast the one row.

So, from above, you should be able to build on what kind of operation you are attempting to get working for the one row.

Once you dumped that massive amount of code you posted (to save world poverty), then we can get the code working for the row click. Once done, then we can consider moving that code to run and operate client side in JavaScript.

But, we first need to get rid of the huge mountain of code you posted - you don't need it, and then we can formulate a question - one based on not attempting to abuse and beat the posters here to death with a club and the boat-load of code you posted that does not make sense, and should not be required. In other words? Try not to show such a huge hate and dislike towards the people here on stack overflow that are willing to help you out.

使用JS将文本添加到GridView列上的按钮按下

死开点丶别碍眼 2025-02-19 11:54:46

您要寻找的称为模态底部。
您可以使用 modal_bottom_sheet package 使用这些功能生成模

showMaterialModalBottomSheet(
  context: context,
  builder: (context) => Container(),
)

底表:

showCupertinoModalBottomSheet(
  context: context,
  builder: (context) => Container(),
)

其他一些软件包可以帮助您实施所需的内容,但是这个包装的数字有很大的差异,最近它是更新了,大约2年前,我在一个项目中使用了它,因此得到了积极的支持。

What you're looking for is called a modal bottom sheet.
you can use modal_bottom_sheet package to generate modal bottom sheets using these functions:

Material Design Style:

showMaterialModalBottomSheet(
  context: context,
  builder: (context) => Container(),
)

or Cupertino Style:

showCupertinoModalBottomSheet(
  context: context,
  builder: (context) => Container(),
)

Some other packages can help you implement what you're looking for, but this one has a huge difference in likes numbers, it has been recently updated, and I used it about 2 years ago in a project so it's been actively supported.

如何进行这种页面过渡的动画? [移动的]

死开点丶别碍眼 2025-02-19 10:45:09

错误是不言自明的。该函数通过整数传递,但是整数没有与它们关联的任何__ len __方法。 len()调用传递给其对象的对象的__ len __函数。 docs

The error is pretty self-explanatory. The function is passed an integer, however integers don't have any __len__ method associated with them. The len() calls the __len__ function of the object that is passed to it. docs

更新破折号绘图时产生的类型错误

死开点丶别碍眼 2025-02-19 08:54:23

找到了解决方案。必须用

sqlite3 -cmd ".print The Tables Are:\n" -cmd ".tables" test.sqlite .quit

sqlite3 test.sqlite ".print The Tables Are:\n" ".tables"

Found the solution. Have to wrap the dot-command and its arguments with ".

sqlite3 -cmd ".print The Tables Are:\n" -cmd ".tables" test.sqlite .quit

or,

sqlite3 test.sqlite ".print The Tables Are:\n" ".tables"

sqlite中的链命令:.print dot-command不起作用

死开点丶别碍眼 2025-02-18 21:52:22

用于计算使用django的 annotate() 计数
要过滤到无效的关系过滤,您可以简单地 排除() 所有行等于none的所有行。

# Answers per Option
qs = Option.objects.annotate(answer_count=Count("multi_choice_answer_set"))
for option in qs:
    print(option, option.answer_count)

# Answers is not null
count = MultiChoiceAnswer.objects.exclude(answers=None).count()

For counting use Django's annotate() together with Count.
To filter for relations that are not null you can simply exclude() all rows where the relation equals None.

# Answers per Option
qs = Option.objects.annotate(answer_count=Count("multi_choice_answer_set"))
for option in qs:
    print(option, option.answer_count)

# Answers is not null
count = MultiChoiceAnswer.objects.exclude(answers=None).count()

计算Django Manytomanys的最快方法?

死开点丶别碍眼 2025-02-18 18:45:09

使用count_if也有效:

with calcflag as (
    select 
        customer_id, 
        IFF(
            count_if(flag_1 = 1) over (
                PARTITION by customer_id 
                order by order_date 
                rows between 2 preceding and current row
            ) = 3, 1, 0
        ) as new_flag 
    from tmp_Test
)
select 
    customer_id, 
    max(new_flag) flag_2
from calcflag
group by 1

+-------------+--------+
| CUSTOMER_ID | FLAG_2 |
|-------------+--------|
|           1 |      1 |
|           2 |      0 |
+-------------+--------+

using COUNT_IF also works:

with calcflag as (
    select 
        customer_id, 
        IFF(
            count_if(flag_1 = 1) over (
                PARTITION by customer_id 
                order by order_date 
                rows between 2 preceding and current row
            ) = 3, 1, 0
        ) as new_flag 
    from tmp_Test
)
select 
    customer_id, 
    max(new_flag) flag_2
from calcflag
group by 1

+-------------+--------+
| CUSTOMER_ID | FLAG_2 |
|-------------+--------|
|           1 |      1 |
|           2 |      0 |
+-------------+--------+

如何通过连续日期变量检查值

死开点丶别碍眼 2025-02-18 14:59:20

为此,您必须使用token_type_hint作为refresh_token生成刷新令牌。使用此令牌呼叫来撤销auth token_type_hint是access_token。

For this, you have to generate a refresh token using token_type_hint as refresh_token. using this token call to auth revoke as token_type_hint is access_token.

如何获取访问令牌以撤销与Apple用户的现有符号?

死开点丶别碍眼 2025-02-18 12:26:41

通常,您需要将控制器与执行工作的服务分开。然后,您将在需要的地方注入此服务,而不是直接使用控制器:

https://learn.microsoft.com/en-us/aspnet/core/core/fundamentals/depparentals/depparency-indoction

?然后首先为API生成客户端,然后在需要的地方注入该客户端:

https://lealen.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=peaspnetcore-6.0

Usually you would want to separate the controller from the service which performs work. Then you would inject this service where needed, instead of using the controller directly:

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-6.0

But if the controller is a separate application, then generate a client for the api first and inject that client where needed:

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-6.0

将值表剃须刀库组件传递到ASP.NET核心MVC控制器

死开点丶别碍眼 2025-02-18 11:14:03

已解决..事实证明,最新版本的ImageMagick 7.1.x不会与ImageMagickObject.dll一起运送,幸运的是,我为早期版本的7.0.8保存了下载.exe,它仍然具有.dll,一旦安装我可以复制我ImageMagickObject.dll到System32文件夹,此后一切都按预期工作。不确定,如果我必须使用较新的版本,如果有人知道,请添加到帖子中,这会替代我的代码中。

Resolved.. It turns out the latest version of Imagemagick 7.1.x does not ship with ImagemagickObject.dll, fortunately, I had a saved download .exe for an earlier version 7.0.8 which still had the .dll, once install I could copy imageMagickObject.dll to the system32 folder, after that everything worked as expected. Not sure what would replace this in my code if I have to ever user a newer version, if someone knows please add to the post.

ImageMagick IIS安装问题VBScript错误&quot“ 800A01AD”

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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