骄傲

文章 评论 浏览 32

骄傲 2025-02-20 19:10:14

更新:我去了不和谐,并由于乐于助人的工作人员找到了答案。

对于其他遇到此问题的人:

此代码对我有用:

@client.command(
name="embed",
description="Test",
scope=[993586870606905404],
)
async def embed(ctx: interactions.CommandContext):
embed = discord.Embed(
  title="your title",
  description="your description",
  color=discord.Color().green,
  timestamp=datetime.datetime.now())
await ctx.send(embeds=embed)

Update: I went to the discord and found the answer due to the helpful staff.

For anyone else having this issue:

This code worked for me:

@client.command(
name="embed",
description="Test",
scope=[993586870606905404],
)
async def embed(ctx: interactions.CommandContext):
embed = discord.Embed(
  title="your title",
  description="your description",
  color=discord.Color().green,
  timestamp=datetime.datetime.now())
await ctx.send(embeds=embed)

如何使用Interactions.py发送嵌入?

骄傲 2025-02-20 17:13:23

就像史蒂文(Steven)所说的global.map是一个单个数组,但您正在访问它,就好像它是二维数组一样。对您的原始代码进行一些较小的调整,可以使其像这样绘制一个网格:

// Init Global Array
global.map[0] = [0,0,0,1,1,0,0,0];
global.map[1] = [0,0,0,1,1,0,0,0];
global.map[2] = [0,0,0,1,1,0,0,0];
global.map[3] = [1,1,1,1,1,1,1,1];
global.map[4] = [1,1,1,1,1,1,1,1];
global.map[5] = [0,0,0,1,1,0,0,0];
global.map[6] = [0,0,0,1,1,0,0,0];
global.map[7] = [0,0,0,1,1,0,0,0];

// Draw global.map as a grid
for (ii=1; ii<9; ii++) {
    for (jj=1; jj<9; jj++) {
        draw_rectangle(15,30,15 + ii * 32, 30 + jj * 32, true);
        draw_text(20 + (ii-1) * 32,35 + (jj-1) * 32 , global.map[ii-1, jj-1]);
    }
}

然后,您将评估grid.map [ii,jj]等于0、1或您想要的任何值并从那里创建分支。值得注意的是,您还可以使用它来查看是否正确显示draw_text(x + 15 + ii * 32,y + 300 + jj * 32,global.map [ii,jj]);> (我确实在 https://yal.cc/r/gml/ 首先,这应该可以解决问题!)。

希望这会有所帮助。

Like Steven said your global.map is a single array but you're accessing it as if it was a two dimensional array. Making some minor adjustments to your original code you can have it draw a grid like so:

// Init Global Array
global.map[0] = [0,0,0,1,1,0,0,0];
global.map[1] = [0,0,0,1,1,0,0,0];
global.map[2] = [0,0,0,1,1,0,0,0];
global.map[3] = [1,1,1,1,1,1,1,1];
global.map[4] = [1,1,1,1,1,1,1,1];
global.map[5] = [0,0,0,1,1,0,0,0];
global.map[6] = [0,0,0,1,1,0,0,0];
global.map[7] = [0,0,0,1,1,0,0,0];

// Draw global.map as a grid
for (ii=1; ii<9; ii++) {
    for (jj=1; jj<9; jj++) {
        draw_rectangle(15,30,15 + ii * 32, 30 + jj * 32, true);
        draw_text(20 + (ii-1) * 32,35 + (jj-1) * 32 , global.map[ii-1, jj-1]);
    }
}

Then you would evaluate if grid.map[ii, jj]is equal to 0, 1, or whatever value you want and create branches from there. Notably for debugging you can also use this to see if the values displaying correctly draw_text(x + 15 + ii * 32, y + 300 + jj * 32 , global.map[ii, jj]); (I did test this in https://yal.cc/r/gml/ first so this should do the trick!).

Hopefully this helps.

访问GML中全局数组的索引

骄傲 2025-02-20 15:32:30

您没有证明问题,但是在调用stack_ini之前,您似乎会分配一个节点。

修复:

t_lst *s = NULL;         // This was wrong.
stack_ini(&s, ...);

完成此操作后,您就有修复stack_ini

void stack_ini(t_lst **prev_next_ptr, char **nbr)
{
    for (; *nbr; ++nbr)
    {
        // Create a new node.
        t_lst *node = malloc(sizeof(t_lst));
        node->content = ft_atoi(*nbr);
        node->next = NULL;

        // Insert it into the list.
        *prev_next_ptr = node;
        prev_next_ptr = &( node->next );
    }
}

You didn't demonstrate the problem, but you appear to allocate a node before calling stack_ini.

Fixed:

t_lst *s = NULL;         // This was wrong.
stack_ini(&s, ...);

Once you do that, you have fix stack_ini.

void stack_ini(t_lst **prev_next_ptr, char **nbr)
{
    for (; *nbr; ++nbr)
    {
        // Create a new node.
        t_lst *node = malloc(sizeof(t_lst));
        node->content = ft_atoi(*nbr);
        node->next = NULL;

        // Insert it into the list.
        *prev_next_ptr = node;
        prev_next_ptr = &( node->next );
    }
}

链接列表末尾的额外元素

骄傲 2025-02-20 12:01:13

这将帮助您。

def test_fun(val):
    x = 0
    y = 1
    z = 2
    myList = []
    if val in (x, y, z) and val == 0:
        myList.append("C")
    if val in (x, y, z) and val == 1:
        myList.append("D")
    if val in (x, y, z) and val == 2:
        myList.append("E")

test_fun(2);

This will help you.

def test_fun(val):
    x = 0
    y = 1
    z = 2
    myList = []
    if val in (x, y, z) and val == 0:
        myList.append("C")
    if val in (x, y, z) and val == 1:
        myList.append("D")
    if val in (x, y, z) and val == 2:
        myList.append("E")

test_fun(2);

骄傲 2025-02-20 08:32:42
nth_element <- function(vector, starting_position, n) {vector[seq(starting_position, length(vector), n)]}

allresults <- lapply(webpage_urls, function(oneurl) {
  read_html(oneurl) %>%
    html_nodes("td") %>%
    html_text() %>%
    nth_element(10, 5)
})
nth_element <- function(vector, starting_position, n) {vector[seq(starting_position, length(vector), n)]}

allresults <- lapply(webpage_urls, function(oneurl) {
  read_html(oneurl) %>%
    html_nodes("td") %>%
    html_text() %>%
    nth_element(10, 5)
})

使用循环/自动化进行HTML Web刮擦

骄傲 2025-02-20 02:09:32

看来您希望cartscreen组件都可以在“/cart/:productid” path上呈现(在更新购物车的情况下) “/cart”路径上也是在查看购物车时。

为此,您需要为每个渲染路由。在这里,我在path =“/cart”上构建了一个布局路由,该路由呈现两个嵌套路由:索引路由cartscreen on ''。代码>和另一个cartscreen “:productid”

<Routes>
  <Route path="/" element={<HomeScreen />} />
  <Route path="/product/:id" element={<ProductScreen />} />
  <Route path="/cart">
    <Route path=":productid" element={<CartScreen />} />
    <Route index element={<CartScreen />} />
  </Route>
</Routes>

注意:如果需要,您可以同样地渲染两条路线。

<Routes>
  <Route path="/" element={<HomeScreen />} />
  <Route path="/product/:id" element={<ProductScreen />} />
  <Route path="/cart:productid" element={<CartScreen />} />
  <Route path="/cart" element={<CartScreen />} />
</Routes>

Cartscreen应以更React> React-Router-dom@6方式处理Querystring。而不是使用USELocation挂钩访问location.search属性,然后应用一些“字符串逻辑”,而是使用 useearchparams 钩直接访问searchParams对象,并获取所需的确切查询参数值。

例子:

const CartScreen = () => {
  const { productid } = useParams();
  const [searchParams, setSearchParams] = useSearchParams();
  const dispatch = useDispatch();
  const { cartItems } = useSelector((state) => state.cart);

  const qty = searchParams.get("qty") || 1;

  useEffect(() => {
    if (qty) {
      // update cart state
      dispatch(addToCart(productid, qty));

      // clear qty queryString param, then "navigate"
      searchParams.delete("qty");
      setSearchParams(searchParams);
    }
  }, [dispatch, productid, qty, searchParams, setSearchParams]);

  return (
    <Row>
      <Col md={8}>
        {!cartItems.length ? (
          <Message variant="info">
            Go Back To Home Page <Link to="/"></Link>
          </Message>
        ) : (
          <ListGroup>
            {cartItems.map((x) => (
              <ListGroup.Item key={x.product}>
                {x.name} , {x.qty}
              </ListGroup.Item>
            ))}
          </ListGroup>
        )}
      </Col>
      <Col md={4}></Col>
    </Row>
  );
};

It seems you want the CartScreen component to render on both the "/cart/:productid" path (in the case of updating the cart) and also on the "/cart" path when just viewing the cart.

For this you need to render a Route for each. Here I've structured a layout route on path="/cart" that renders two nested routes: an index route rendering a CartScreen on "." and another CartScreen on ":productid".

<Routes>
  <Route path="/" element={<HomeScreen />} />
  <Route path="/product/:id" element={<ProductScreen />} />
  <Route path="/cart">
    <Route path=":productid" element={<CartScreen />} />
    <Route index element={<CartScreen />} />
  </Route>
</Routes>

Note: You could equally render two routes individually we well if desired.

<Routes>
  <Route path="/" element={<HomeScreen />} />
  <Route path="/product/:id" element={<ProductScreen />} />
  <Route path="/cart:productid" element={<CartScreen />} />
  <Route path="/cart" element={<CartScreen />} />
</Routes>

The CartScreen should handle the queryString in a more react-router-dom@6 way. Instead of using the useLocation hook to access the location.search property, and then applying some "string logic", use the useSearchParams hook to directly access a searchParams object and get the exact queryString parameter value needed.

Example:

const CartScreen = () => {
  const { productid } = useParams();
  const [searchParams, setSearchParams] = useSearchParams();
  const dispatch = useDispatch();
  const { cartItems } = useSelector((state) => state.cart);

  const qty = searchParams.get("qty") || 1;

  useEffect(() => {
    if (qty) {
      // update cart state
      dispatch(addToCart(productid, qty));

      // clear qty queryString param, then "navigate"
      searchParams.delete("qty");
      setSearchParams(searchParams);
    }
  }, [dispatch, productid, qty, searchParams, setSearchParams]);

  return (
    <Row>
      <Col md={8}>
        {!cartItems.length ? (
          <Message variant="info">
            Go Back To Home Page <Link to="/"></Link>
          </Message>
        ) : (
          <ListGroup>
            {cartItems.map((x) => (
              <ListGroup.Item key={x.product}>
                {x.name} , {x.qty}
              </ListGroup.Item>
            ))}
          </ListGroup>
        )}
      </Col>
      <Col md={4}></Col>
    </Row>
  );
};

Cartitems应用程序没有匹配的路线

骄傲 2025-02-19 08:35:35

安装反应本机复活

expo install react-native-reanimated

Install react native reanimated

expo install react-native-reanimated

您可能需要一个额外的装载机来处理这些加载程序的结果

骄傲 2025-02-19 01:36:13

如何使用简单的汇总函数实现想要实现想要的东西的完整示例:

create table test (col1 text, col2 text, col3 text);

insert into test values ('U1', 'L1', 'X');
insert into test values ('U1', 'L5', 'X');
insert into test values ('U2', 'L2', 'X');
insert into test values ('U3', 'L2', 'X');
insert into test values ('U4', 'L4', 'X');
insert into test values ('U4', 'L6', 'X');
insert into test values ('U5', 'L7', 'X');
select
  col1
from (
  select 
    col1,
    -- aggregate all occurences for each value in col1 and see if any is missing, if so this will be false
    bool_and(col2 in ('L1', 'L2', 'L3', 'L4')) as has_value
  from test 
  where col3 = 'X'
  group by col1
) agg
where has_value;

A full example of how to achieve what you want using a simple aggregate function:

create table test (col1 text, col2 text, col3 text);

insert into test values ('U1', 'L1', 'X');
insert into test values ('U1', 'L5', 'X');
insert into test values ('U2', 'L2', 'X');
insert into test values ('U3', 'L2', 'X');
insert into test values ('U4', 'L4', 'X');
insert into test values ('U4', 'L6', 'X');
insert into test values ('U5', 'L7', 'X');
select
  col1
from (
  select 
    col1,
    -- aggregate all occurences for each value in col1 and see if any is missing, if so this will be false
    bool_and(col2 in ('L1', 'L2', 'L3', 'L4')) as has_value
  from test 
  where col3 = 'X'
  group by col1
) agg
where has_value;

SQL:排除行,如果其中至少一行是列表中的一行

骄傲 2025-02-18 22:46:11

尝试以这样的方式进行导入:import {xlsxworkbook,xlsxsheet,xlsxdownload}来自'vue3-xlsx'>

Try do the import like this instead: import { XlsxWorkbook, XlsxSheet, XlsxDownload } from 'vue3-xlsx'

导出表为.xlsx格式在VUE 3中

骄傲 2025-02-18 21:29:04

您应该检查您的代码。我看到的教程(有很多在线)以这种方式导入美丽的小组(套管很重要 - bs是较高的情况!):

from bs4 import BeautifulSoup

示例:示例:
https://beautiful-soup--4.readthedocs.io /en/最新/#制作 - 组合

You should check your code. The tutorials I see (there are many online) all import beautifulsoup this way (casing matters - the B and the S are upper case!):

from bs4 import BeautifulSoup

Example:
https://beautiful-soup-4.readthedocs.io/en/latest/#making-the-soup

安装了美丽的模块,但可以找到

骄傲 2025-02-18 10:56:59

我希望有可能在全球范围内覆盖这一点,而不必记住从其他位置导入库,但至少它有效。

src/utils/web3.ts
import { useWeb3React as useWeb3React_ } from '@web3-react/core'

export const useWeb3React: < T = any >(key?: string) => Modify<
  ReturnType<typeof useWeb3React_<T>>,
  { chainId: SupportedChainIds }
> = useWeb3React_ as any

declare global {
  type SupportedChainIds = 1 | 4
}

在所需的文件

// import { useWeb3React } from '@web3-react/core' // before
import { useWeb3React } from 'src/utils/web3'      // after

const MyComponent: React.FC = () => {
  const { chainId } = useWeb3React()      // chainId: 1 | 4
  return <MyForm baseChainId={chainId} /> // no error ✔
}

modify&lt;原始,newType&gt; type

typescript d.ts d.ts file file 的覆盖接口属性类型

I wish it was possible to override this on a global level, without having to remember to import the library from a different location, but at least it works.

src/utils/web3.ts
import { useWeb3React as useWeb3React_ } from '@web3-react/core'

export const useWeb3React: < T = any >(key?: string) => Modify<
  ReturnType<typeof useWeb3React_<T>>,
  { chainId: SupportedChainIds }
> = useWeb3React_ as any

declare global {
  type SupportedChainIds = 1 | 4
}

In the desired file

// import { useWeb3React } from '@web3-react/core' // before
import { useWeb3React } from 'src/utils/web3'      // after

const MyComponent: React.FC = () => {
  const { chainId } = useWeb3React()      // chainId: 1 | 4
  return <MyForm baseChainId={chainId} /> // no error ✔
}

Modify<Original, Newtype> type

Overriding interface property type defined in Typescript d.ts file

打字稿界面合并以使外部lib的接口属性更具体

骄傲 2025-02-17 08:03:21

根据我的理解
您想与堆栈中的底部小部件进行交互,如果是这种情况,则忽略指针可以为您提供帮助。

只需将上面的小部件用像这样的忽略堆栈中的堆栈中。

Stack(
children:[
  Container(color:Colors.red) // this is where you want to interact and 
                            //this containerbottom of the stack.
  IgnorePointer(
          ignoring: true,
          Container(color:Colors.blue)// top container
   )
 ])

As per my understanding
You want to interact with the bottom widget in the stack, if this is the case then Ignore pointer can help you.

Just wrap the above widgets in the stack with IgnorePointer just like this.

Stack(
children:[
  Container(color:Colors.red) // this is where you want to interact and 
                            //this containerbottom of the stack.
  IgnorePointer(
          ignoring: true,
          Container(color:Colors.blue)// top container
   )
 ])

颤音:放大&amp;放大堆栈中的图像

骄傲 2025-02-17 04:09:10

pandas query> query 过滤数据框。然后在结果上使用unique()返回唯一名称。

rows = df.query('age == 2 and cond == 9')
print(rows["name"].unique())

有关更多查询示例,请参见在这里

The Pandas query function allows for SQL-like queries to filter a data frame. Then use unique() on the results to return the unique name.

rows = df.query('age == 2 and cond == 9')
print(rows["name"].unique())

For more query examples, see here.

根据条件找到列值

骄傲 2025-02-16 22:32:56

我认为这是您要归类的逻辑:

bool isColliding = false;

do
{
    enemyUfoRecs[i].X = rng.Next(1, 1720);
    isColliding = false;

    for (int j = 0; j <= enemyUfoRecs.Length - 1; j++)
    {
        if (i != j && enemyUfoRecs[j].Intersects(enemyUfoRecs[i]))
        {
            isColliding = true;
        }
        break;
    }
}
while (isColliding == true)

区别在do-while循环中,并在do-nile循环时至少遍历代码,然后查看wher> 之后检查是否需要再次重复。

I think this is the logic you want to archieve:

bool isColliding = false;

do
{
    enemyUfoRecs[i].X = rng.Next(1, 1720);
    isColliding = false;

    for (int j = 0; j <= enemyUfoRecs.Length - 1; j++)
    {
        if (i != j && enemyUfoRecs[j].Intersects(enemyUfoRecs[i]))
        {
            isColliding = true;
        }
        break;
    }
}
while (isColliding == true)

The difference is in the do-while loop, with a do-while loop, it goes through the code at least once, and then look at the while check afterwards if it needs to be repeated again.

当物体在彼此的顶部产生时重新定位

骄傲 2025-02-16 18:57:00

用填充包裹您的下拉小部件。在您的情况下,您需要

填充:edgeinsets.symmetric(4)

list?.add(
  Container(
     padding: EdgeInsets.symmetric(vertical: 8),
     child: _buildDropdownField(
       text: '',
       enabled: true,
       progress: false,
       dropdownOptions:options ?? [],
       focusNode: FocusNode(),
       applySelected: true,
       action: SvgPicture.asset(Img.dropdownArrow),
       labelText: name,
       dropdownItemSelected: (item) {
         BlocProvider.of<SimpleOrderBloc>(context).add(
            SimpleOrderDropdownMenuAdditionItemSelectedEvent(item));
       },
       textChanged: (text) {})));

Wrap your drop-down widget with padding. in your case you need

padding: EdgeInsets.symmetric(4)

list?.add(
  Container(
     padding: EdgeInsets.symmetric(vertical: 8),
     child: _buildDropdownField(
       text: '',
       enabled: true,
       progress: false,
       dropdownOptions:options ?? [],
       focusNode: FocusNode(),
       applySelected: true,
       action: SvgPicture.asset(Img.dropdownArrow),
       labelText: name,
       dropdownItemSelected: (item) {
         BlocProvider.of<SimpleOrderBloc>(context).add(
            SimpleOrderDropdownMenuAdditionItemSelectedEvent(item));
       },
       textChanged: (text) {})));

如何添加到下拉列表,它们之间的距离?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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