墨小墨

文章 评论 浏览 28

墨小墨 2025-02-20 19:15:09

您需要为此调整变压素。我这样做了,它对我有用:

<Select 
        ...
        MenuProps={{
          anchorOrigin: {
            vertical: 'top',
            horizontal: 'center'
          },
          transformOrigin: {
            vertical: 'bottom',
            horizontal: 'center'
          }
        }}
      >
        <MenuItem ...>
          Menu item 1
        </MenuItem>
        <MenuItem ...>
          Menu item 2
        </MenuItem>
      </Select>

You'll want to adjust the transformOrigin for that. I did it like this and it worked for me:

<Select 
        ...
        MenuProps={{
          anchorOrigin: {
            vertical: 'top',
            horizontal: 'center'
          },
          transformOrigin: {
            vertical: 'bottom',
            horizontal: 'center'
          }
        }}
      >
        <MenuItem ...>
          Menu item 1
        </MenuItem>
        <MenuItem ...>
          Menu item 2
        </MenuItem>
      </Select>

MUI-如何将选择选项定位在选择组件上方

墨小墨 2025-02-20 15:59:15

您几乎可以使用列表理解来创建一个新列表,并分配给DF ['c'],如下所示;

df['c'] = [np.array(x)*2 for x in df['a'].to_list()]

You are almost there you can utilize list comprehension to create a new list and assign to df['c'] as follows;

df['c'] = [np.array(x)*2 for x in df['a'].to_list()]

用给定属性在数据框中添加列

墨小墨 2025-02-20 11:49:22

$ t() in &lt; script&gt;从未工作...您必须使用this。$ t()如果您使用的是旧选项API

如果要在设置内使用i18n,则usei18n() api 必须使用

$t() in <script> never worked ...you must use this.$t() if you are using old Options API

If you want to use i18n inside setup, the useI18n() API must be used

使用vue-i18n与脚本设置和打字稿

墨小墨 2025-02-20 04:00:38

是基于语音的频道中成员的集合。集合具有size属性,因此类似的东西应该有效:

function usercount(voiceState) {
  let { members } = voiceState.channel;

  console.log(members);

  return members.size;
}

VoiceChannel#members is a collection of the members in a voice-based channel. Collection's have a size property, so something like this should work:

function usercount(voiceState) {
  let { members } = voiceState.channel;

  console.log(members);

  return members.size;
}

如何检查语音频道中有多少成员?

墨小墨 2025-02-20 02:32:52

我的同样问题,这意味着您的机器上安装了纱线,但纱线的可执行文件目录不在系统的路径中。

按照下面的步骤操作:

  1. 检查纱线安装目录:
    NPM bin -g

  2. 添加YARN的安装目录(从上一步生成path/to/your/your/your/your/your/your/your/your/your/bin)到系统路径

  • linux/macOS:
    添加
    导出路径=“ path:/path/to/yarn/bin”
    〜/.bashrc〜/.zshhrc〜/.bash_profile

  • Windows:
    控制面板&gt;系统&GT;高级系统设置&gt;环境变量
    编辑路径变量可包括目录(path/to/your/your/your/your/your/bin)。

  1. 重新启动终端或命令提示或git bash

  2. 验证纱线安装
    纱线 - Version

那些解决了我的问题的人

same issue with mine, that means yarn is installed on your machine but yarn's executable directory is not in system's PATH.

follow steps below:

  1. check yarn installation directory:
    npm bin -g

  2. add yarn's installation directory (generated from previous step path/to/your/yarn/bin) to system path

  • Linux/MacOS:
    Add
    export PATH="PATH:/path/to/yarn/bin"
    to ~/.bashrc or ~/.zshhrc or ~/.bash_profile

  • Windows:
    Control Panel > System > Advanced system settings > Environment variables
    Edit PATH variable to include the directory (path/to/your/yarn/bin).

  1. Restart Terminal or Command Prompt or Git Bash

  2. Verify yarn Installation
    yarn --version

those solved my problem

无法在Windows上安装纱线

墨小墨 2025-02-19 23:23:14

为了清楚起见,您应该继续进行以下操作:

import numpy as np

r1 = np.array([[150.        , 132.5001244 , 115.00024881],
               [ 97.50037321,  80.00049761,  62.50062201],
               [ 45.00074642,  27.50087082,  10.00099522]])

# make a copy and shuffle the copy
r2 = r1.copy()
np.random.shuffle(r2.ravel())

# get the index of the max
idx = np.unravel_index(r2.argmax(), r2.shape)

# swap first and max
r2[idx], r2[(0, 0)] = r2[(0, 0)], r2[idx]

print(r2)

如果

最初排序阵列,则可以使用阵列的平坦视图:

r1 = np.array([[150.        , 132.5001244 , 115.00024881],
               [ 97.50037321,  80.00049761,  62.50062201],
               [ 45.00074642,  27.50087082,  10.00099522]])

r2 = r1.copy()

# r2.ravel() returns a view of the original array
# so we can shuffle only the items starting from 1
np.random.shuffle(r2.ravel()[1:])

可能的输出:

[[150.          80.00049761  62.50062201]
 [ 97.50037321 132.5001244  115.00024881]
 [ 45.00074642  27.50087082  10.00099522]]

For clarity, here is how you should proceed:

import numpy as np

r1 = np.array([[150.        , 132.5001244 , 115.00024881],
               [ 97.50037321,  80.00049761,  62.50062201],
               [ 45.00074642,  27.50087082,  10.00099522]])

# make a copy and shuffle the copy
r2 = r1.copy()
np.random.shuffle(r2.ravel())

# get the index of the max
idx = np.unravel_index(r2.argmax(), r2.shape)

# swap first and max
r2[idx], r2[(0, 0)] = r2[(0, 0)], r2[idx]

print(r2)

Alternative

If the the array is initially sorted, we can use a flat view of the array:

r1 = np.array([[150.        , 132.5001244 , 115.00024881],
               [ 97.50037321,  80.00049761,  62.50062201],
               [ 45.00074642,  27.50087082,  10.00099522]])

r2 = r1.copy()

# r2.ravel() returns a view of the original array
# so we can shuffle only the items starting from 1
np.random.shuffle(r2.ravel()[1:])

possible output:

[[150.          80.00049761  62.50062201]
 [ 97.50037321 132.5001244  115.00024881]
 [ 45.00074642  27.50087082  10.00099522]]

在Python开头,将一个具有最大元素的Numpy阵列洗牌

墨小墨 2025-02-19 19:09:26

另一个dplyr + purrr选项可能是:

dta %>%
 mutate(pmap_dfr(across(-ID), ~ `[<-`(c(...), seq_along(c(...)) > match(1, c(...)), 1)))

  ID Q0 Q1 Q2 Q3 Q4
1  A  0  0  0  0  0
2  B  0  1  1  1  1
3  C  0  0  1  1  1
4  D  0  0  0  1  1
5  E  0 NA NA NA NA
6  F  0  1  1  1  1

Yet another dplyr + purrr option could be:

dta %>%
 mutate(pmap_dfr(across(-ID), ~ `[<-`(c(...), seq_along(c(...)) > match(1, c(...)), 1)))

  ID Q0 Q1 Q2 Q3 Q4
1  A  0  0  0  0  0
2  B  0  1  1  1  1
3  C  0  0  1  1  1
4  D  0  0  0  1  1
5  E  0 NA NA NA NA
6  F  0  1  1  1  1

从一列到下一个给定条件的复制值

墨小墨 2025-02-19 10:36:54

指定相互依存的链接库的顺序是错误的。

如果库相互依赖,则链接的库的顺序确实很重要。通常,如果库a取决于库b,则liba 必须libb 在链接标志中。

例如:

// B.h
#ifndef B_H
#define B_H

struct B {
    B(int);
    int x;
};

#endif

// B.cpp
#include "B.h"
B::B(int xx) : x(xx) {}

// A.h
#include "B.h"

struct A {
    A(int x);
    B b;
};

// A.cpp
#include "A.h"

A::A(int x) : b(x) {}

// main.cpp
#include "A.h"

int main() {
    A a(5);
    return 0;
};

创建库:

$ g++ -c A.cpp
$ g++ -c B.cpp
$ ar rvs libA.a A.o 
ar: creating libA.a
a - A.o
$ ar rvs libB.a B.o 
ar: creating libB.a
a - B.o

编译:

$ g++ main.cpp -L. -lB -lA
./libA.a(A.o): In function `A::A(int)':
A.cpp:(.text+0x1c): undefined reference to `B::B(int)'
collect2: error: ld returned 1 exit status
$ g++ main.cpp -L. -lA -lB
$ ./a.out

为了重复重复,顺序很重要!

The order in which interdependent linked libraries are specified is wrong.

The order in which libraries are linked DOES matter if the libraries depend on each other. In general, if library A depends on library B, then libA MUST appear before libB in the linker flags.

For example:

// B.h
#ifndef B_H
#define B_H

struct B {
    B(int);
    int x;
};

#endif

// B.cpp
#include "B.h"
B::B(int xx) : x(xx) {}

// A.h
#include "B.h"

struct A {
    A(int x);
    B b;
};

// A.cpp
#include "A.h"

A::A(int x) : b(x) {}

// main.cpp
#include "A.h"

int main() {
    A a(5);
    return 0;
};

Create the libraries:

$ g++ -c A.cpp
$ g++ -c B.cpp
$ ar rvs libA.a A.o 
ar: creating libA.a
a - A.o
$ ar rvs libB.a B.o 
ar: creating libB.a
a - B.o

Compile:

$ g++ main.cpp -L. -lB -lA
./libA.a(A.o): In function `A::A(int)':
A.cpp:(.text+0x1c): undefined reference to `B::B(int)'
collect2: error: ld returned 1 exit status
$ g++ main.cpp -L. -lA -lB
$ ./a.out

So to repeat again, the order DOES matter!

什么是未定义的参考/未解决的外部符号错误,我该如何修复?

墨小墨 2025-02-18 11:29:11

我建议使用build-in 格式>格式>格式> /a> - 呼吸而不是F弦:它更具用途,因为您可以制作一个模板字符串,该模板字符串在其他“人”的数据中共享。可以通过将其传递给模板的字典理解来收集人均数据。注意字典的键值扩展,**

# form per person

string_template = "{name}, is a {profession} for  {no_of_years} years  in {cities}, {states}"
keys = 'name', 'profession', 'no_of_years', 'cities', 'states'

data = {k: input(f'Insert {k}: ') for k in keys}

print(string_template.format(**data)) # key-value expansion

要进一步减少string_format之间的依赖关系,一个人可以使用(再次)String- 格式函数:

# per person
keys = 'name', 'profession', 'no_of_years', 'cities', 'states'

string_template = "{}, is a {} for  {} years  in {}, {}".format(*map('{{{}}}'.format, keys))
...

注意in { {{}}}需要两个括号来逃脱符号,最后一个用format替换。


这里可能的交互式程序:

keys = 'name', 'profession', 'no_of_years', 'cities', 'states'

string_format = "{}, is a {} for  {} years  in {}, {}".format(*map('{{{}}}'.format, keys))

data_people = []
while True:
    main_menu_selection = input('[enter] Add a person\n[q] Quit')
    if main_menu_selection == 'q':
        print('Quit.')
        break

    data_person = {k: input(f'Insert {k}: ') for k in keys}
    data_person_str = string_format.format(**data_person)
    data_people.append(data_person_str)

print(*data_people, sep='\n')

I would recommend to use the build-in format-approach instead of the f-string: it is more versatile since you can make a template string which is shared among the data of other "people". The data per person can be collected with a dictionary comprehension which will be passed to the template. Notice the key-value expansion of the dictionary, **.

# form per person

string_template = "{name}, is a {profession} for  {no_of_years} years  in {cities}, {states}"
keys = 'name', 'profession', 'no_of_years', 'cities', 'states'

data = {k: input(f'Insert {k}: ') for k in keys}

print(string_template.format(**data)) # key-value expansion

To further reduce the dependency between the keys and string_format one can use (again) the string-format functionality:

# per person
keys = 'name', 'profession', 'no_of_years', 'cities', 'states'

string_template = "{}, is a {} for  {} years  in {}, {}".format(*map('{{{}}}'.format, keys))
...

Notice the in {{{}}} two brackets are needed for escape the symbol and the last for the substitution with format.


Here a possible interactive program:

keys = 'name', 'profession', 'no_of_years', 'cities', 'states'

string_format = "{}, is a {} for  {} years  in {}, {}".format(*map('{{{}}}'.format, keys))

data_people = []
while True:
    main_menu_selection = input('[enter] Add a person\n[q] Quit')
    if main_menu_selection == 'q':
        print('Quit.')
        break

    data_person = {k: input(f'Insert {k}: ') for k in keys}
    data_person_str = string_format.format(**data_person)
    data_people.append(data_person_str)

print(*data_people, sep='\n')

在一句话中打印信息

墨小墨 2025-02-17 23:28:53

父母的过滤器总是会影响孩子,然后您可以使用:: pseudo元素来解决它

.parent {
  width: 100px;
  height: 150px;
  position: relative;
}

.parent::after {
  content: '';
  width: 100%;
  height: 100%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: block;
  background-image: url(https://cdn.pixabay.com/photo/2022/06/07/15/56/child-7248693_1280.jpg);
  background-size: cover;
  background-position: center;
  filter: blur(5px);
  z-index: -1;
}

.child {
  z-index: 1;
}
<div class="parent">
  <p class="child">
    text
  </p>
</div>

a parent's filter always affect the child, then you can use ::after pseudo element to solve it

.parent {
  width: 100px;
  height: 150px;
  position: relative;
}

.parent::after {
  content: '';
  width: 100%;
  height: 100%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: block;
  background-image: url(https://cdn.pixabay.com/photo/2022/06/07/15/56/child-7248693_1280.jpg);
  background-size: cover;
  background-position: center;
  filter: blur(5px);
  z-index: -1;
}

.child {
  z-index: 1;
}
<div class="parent">
  <p class="child">
    text
  </p>
</div>

模糊的父母,但孩子不继承HTML CSS

墨小墨 2025-02-17 17:38:06

答案是display:inline-block,但是如果您想要这种行为,则应使用span,因为默认情况下跨度为内联元素。它不需要任何其他样式

p {
  display: inline-block;
}
<p>aaaaaaaaaaaaaaa</p>
<p>bbbbbbbbbbbbbbb</p>

The answer is display: inline-block, but if you want this kind of behaviour u should use span as span is inline element by default. It does not need any additional style

p {
  display: inline-block;
}
<p>aaaaaaaaaaaaaaa</p>
<p>bbbbbbbbbbbbbbb</p>

有没有办法使2&lt; p&gt;同一行中的标签

墨小墨 2025-02-17 15:31:45

这与您的问题无关,但是您要在功能调用中使用=而不是&lt; -。如果您使用&lt; -,最终将创建变量y1y2在您工作的任何环境中:

d1 <- data.frame(y1 <- c(1, 2, 3), y2 <- c(4, 5, 6))
y1
# [1] 1 2 3
y2
# [1] 4 5 6

这赢了' T在数据框架中创建列名的效果看似所需的效果:

d1
#   y1....c.1..2..3. y2....c.4..5..6.
# 1                1                4
# 2                2                5
# 3                3                6

另一方面,=运算符将使您的向量与参数与data.frame.frame相关联。

至于您的问题,列出数据帧很容易:

d1 <- data.frame(y1 = c(1, 2, 3), y2 = c(4, 5, 6))
d2 <- data.frame(y1 = c(3, 2, 1), y2 = c(6, 5, 4))
my.list <- list(d1, d2)

您访问数据帧,就像您访问其他列表元素一样:

my.list[[1]]
#   y1 y2
# 1  1  4
# 2  2  5
# 3  3  6

This isn't related to your question, but you want to use = and not <- within the function call. If you use <-, you'll end up creating variables y1 and y2 in whatever environment you're working in:

d1 <- data.frame(y1 <- c(1, 2, 3), y2 <- c(4, 5, 6))
y1
# [1] 1 2 3
y2
# [1] 4 5 6

This won't have the seemingly desired effect of creating column names in the data frame:

d1
#   y1....c.1..2..3. y2....c.4..5..6.
# 1                1                4
# 2                2                5
# 3                3                6

The = operator, on the other hand, will associate your vectors with arguments to data.frame.

As for your question, making a list of data frames is easy:

d1 <- data.frame(y1 = c(1, 2, 3), y2 = c(4, 5, 6))
d2 <- data.frame(y1 = c(3, 2, 1), y2 = c(6, 5, 4))
my.list <- list(d1, d2)

You access the data frames just like you would access any other list element:

my.list[[1]]
#   y1 y2
# 1  1  4
# 2  2  5
# 3  3  6

如何列出数据帧列表?

墨小墨 2025-02-17 07:04:17

经过进一步的调查, nat 似乎是答案。

根据这些解释 > loopback 接口和 docker0 桥。

由于以下内容,因此Windows的Docker Desktop无法识别这一点(“ nofollow noreferrer”> source ):

由于Windows的Docker桌面中实现了网络的方式,因此您在主机上看不到Docker0接口。该接口实际上在虚拟机中。

After further investigation, NAT seems to be the answer.

According to these explanations, a NAT is involved between the loopback interface and the docker0 bridge.

This is less recognizable with Docker Desktop for Windows because of the following (source):

Because of the way networking is implemented in Docker Desktop for Windows, you cannot see a docker0 interface on the host. This interface is actually within the virtual machine.

为什么我的Docker应用程序可以在不发布端口的情况下接收UDP数据?

墨小墨 2025-02-17 05:43:44

但是,为什么编译器认为L2的静态型与L1相同? ((
因此,没有编译器错误)

,因为它们完全相同。变量的编译时类型l1l2均为list&lt;扩展数字&gt;

在方法中可能发生运行时错误

NO中发生,运行时错误不会发生。任务是完全安全的。可以用l2的类型指向的任何东西都可以用l1的类型指出。

由于使用了通配符,因此它们的类型可能是继承的任何东西
从数字。

我认为您正在考虑这样一个事实,例如,您可以将列表&lt; integer&gt;作为第一个参数,而list&lt; double&gt;作为第二个参数。是的,这很好。然后,l1将指向list&lt; integer&gt;l2将指向list&lt; double&gt;。然后,当您做l1 = l2;时,您可以同时进行l1l2指向list&lt; double; double&gt; 。很好。由于l1具有类型列表&lt;?扩展数字&gt;,有时可以指向list&lt; integer&gt;,而在其他时候则指向list&lt; double&gt;。考虑一个更简单的示例:

public void func4(Object o1, Object o2) {
    o1 = o2;
}

我可以将字符串作为第一个参数,而整数作为第二个参数,这很好。分配O1 = O2;将导致o1o2指向Integer对象和o1o2可以做到这一点,因为它们具有对象

but why the compiler thinks the static-type of l2 is the same as l1? (
hence, there's no compiler error )

Because they are exactly the same. The compile-time type of the variables l1 and l2 are both List<? extends Number>.

Run-time error could occur in the method

No, runtime error cannot occur. The assignment is completely safe. Anything that can be pointed to by the type of l2 can be pointed to by the type of l1.

since wildcards are used, their types could be anything that inherits
from Number.

I think you are thinking of the fact that, for example, you can pass a List<Integer> as first argument and a List<Double> as second argument. Yes, and that's perfectly fine. Then l1 will point to the List<Integer> and l2 will point to the List<Double>. Then when you do l1 = l2;, you make both l1 and l2 point to the List<Double>. And that's fine. Since l1 has type List<? extends Number>, it can sometimes point to a List<Integer> and at other times point to a List<Double>. Consider a simpler example:

public void func4(Object o1, Object o2) {
    o1 = o2;
}

I can pass a String as first argument and an Integer as second argument, and that's perfectly fine. The assignment o1 = o2; will cause both o1 and o2 to point to the Integer object, and o1 and o2 can do that since they have type Object.

使用通配符参数分配相同的通用类型

墨小墨 2025-02-17 02:13:03

日期非常烦人。确保您使用正确日期的最佳选择是使用日期函数,然后根据需要格式化输出:

Sub DateConvert()
    
    Dim ws As Worksheet:    Set ws = ActiveWorkbook.Worksheets("Sheet1")
    Dim rData As Range:     Set rData = ws.Range("C2", ws.Cells(ws.Rows.Count, "C").End(xlUp))
    If rData.Row < 2 Then Exit Sub  'No data
    
    'Load range data into an array
    Dim aData() As Variant
    If rData.Cells.Count = 1 Then
        ReDim aData(1 To 1, 1 To 1)
        aData(1, 1) = rData.Value
    Else
        aData = rData.Value
    End If
    
    'Loop over array and perform conversion
    Dim aDateValues As Variant
    Dim i As Long
    For i = 1 To UBound(aData, 1)
        aDateValues = Split(Replace(aData(i, 1), "Invoice Date:", vbNullString), "/")   'Remove the extra text and pull the date values
        aData(i, 1) = DateSerial(aDateValues(2), aDateValues(1), aDateValues(0))        'Use DateSerial to guarantee correct date
    Next i
    
    'Output results to sheet with desired date format
    With rData
        .Value = aData
        .NumberFormat = "dd/mm/yyyy"
    End With
    
End Sub

Dates are extremely annoying to work with. Your best bet for making sure you're working with the correct date is to use the DateSerial function, and then format the output as desired:

Sub DateConvert()
    
    Dim ws As Worksheet:    Set ws = ActiveWorkbook.Worksheets("Sheet1")
    Dim rData As Range:     Set rData = ws.Range("C2", ws.Cells(ws.Rows.Count, "C").End(xlUp))
    If rData.Row < 2 Then Exit Sub  'No data
    
    'Load range data into an array
    Dim aData() As Variant
    If rData.Cells.Count = 1 Then
        ReDim aData(1 To 1, 1 To 1)
        aData(1, 1) = rData.Value
    Else
        aData = rData.Value
    End If
    
    'Loop over array and perform conversion
    Dim aDateValues As Variant
    Dim i As Long
    For i = 1 To UBound(aData, 1)
        aDateValues = Split(Replace(aData(i, 1), "Invoice Date:", vbNullString), "/")   'Remove the extra text and pull the date values
        aData(i, 1) = DateSerial(aDateValues(2), aDateValues(1), aDateValues(0))        'Use DateSerial to guarantee correct date
    Next i
    
    'Output results to sheet with desired date format
    With rData
        .Value = aData
        .NumberFormat = "dd/mm/yyyy"
    End With
    
End Sub

VBA查找&amp;更换更改日期为我们格式

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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