软的没边

文章 评论 浏览 27

软的没边 2025-01-30 22:03:01

尝试以下操作:

const response = await fetch(
        `https://jsonplaceholder.typicode.com/posts?userId= ${this.props.idno}`
      );

模板文字(``)是在字符串中包含表达式和变量的能力。

Try this:

const response = await fetch(
        `https://jsonplaceholder.typicode.com/posts?userId= ${this.props.idno}`
      );

Template literal(``) is the ability to include expressions and variables within a string.

如何从子类组件中的父级组件中访问道具? (专门针对componentDidmount)?

软的没边 2025-01-30 20:24:27

尝试使用OnClick事件而不是Onchange,应在选择元素上而不是选项元素上使用Onchange。因此,要么将选项包装在选择中并使用Onchange,要么尝试在选项上使用OnClick。

Try using onClick event instead of onChange, onChange should be used on a select element and not on an option element. So either wrap the options in a select and use onChange or try using the onClick on the options.

无法进入Select/Option菜单中的所需路径

软的没边 2025-01-30 10:27:10

因此,经过更多的挖掘,我在Python Pep 8编程建议中找到了这一点( https:> https:> https:> https:> https: //peps.python.org/pep-0008/#programmend-recommendations

# Not recommended
my_list = []
if not len(my_list):
    print('List is empty!')

# Recommended
my_list = []
if not my_list:
    print('List is empty!')

所以现在您知道了查看列表是否为空的最柔软的方法!

经过一番测试后,我甚至在自定义课程中都发现了这项工作!但是我的测试可能不完整。

class Test:
    def __init__(self, len):
        self.len = len

    def __len__(self):
        return self.len


t1 = Test(3)
if len(t1):
    print("len1 > 0")
if t1:
    print("len2 > 0")

t1 = Test(0)
if len(t1):
    print("len3 > 0")
if t1:
    print("len4 > 0")

t1 = Test(-1)
if len(t1):
    print("len5 > 0")

印刷

len1 > 0
len2 > 0

Exception has occurred: ValueError
__len__() should return >= 0

So, after some more digging I found this in the python PEP 8 programming recommendations (https://peps.python.org/pep-0008/#programming-recommendations)

# Not recommended
my_list = []
if not len(my_list):
    print('List is empty!')

# Recommended
my_list = []
if not my_list:
    print('List is empty!')

so now you know the most pythonic way to check if a list is empty!

After testing a bit, I found this works even for custom classes! But my test might be incomplete.

class Test:
    def __init__(self, len):
        self.len = len

    def __len__(self):
        return self.len


t1 = Test(3)
if len(t1):
    print("len1 > 0")
if t1:
    print("len2 > 0")

t1 = Test(0)
if len(t1):
    print("len3 > 0")
if t1:
    print("len4 > 0")

t1 = Test(-1)
if len(t1):
    print("len5 > 0")

prints

len1 > 0
len2 > 0

Exception has occurred: ValueError
__len__() should return >= 0

使用< =运算符代替==加上假设的缺点

软的没边 2025-01-30 01:05:13

模式(MySQL V8.0)

CREATE TABLE test (
  id INT,
  date text,
  status INT,
  value INT
);
INSERT INTO test VALUES (1, '01.01.2022', 1, 60);
INSERT INTO test VALUES (2, '01.01.2022', 1, 30);
INSERT INTO test VALUES (3, '01.01.2022', 7, 90);
INSERT INTO test VALUES (1, '02.01.2022', 7, 60);
INSERT INTO test VALUES (2, '02.01.2022', 7, 30);
INSERT INTO test VALUES (3, '02.01.2022', 3, 90);
INSERT INTO test VALUES (1, '03.01.2022', 7, 60);
INSERT INTO test VALUES (2, '03.01.2022', 5, 30);
INSERT INTO test VALUES (3, '03.01.2022', 7, 90);

查询#1

SELECT
ID,
MAX(VALUE) AS VALUE, 
sum(CASE WHEN date = '01.01.2022' THEN status ELSE 0 END) AS '01.01.2022',
sum(CASE WHEN date = '02.01.2022' THEN status ELSE 0 END) AS '02.01.2022',
sum(CASE WHEN date = '03.01.2022' THEN status ELSE 0 END) AS '03.01.2022'
FROM test
GROUP BY ID;
ID 01.01.01.2022 02.01.2022 03.01.2022
1 60 1 60 1 7 7 7 7
2 30 1 7 5
3 90 7 3 90 7 3 7 3 7

在DB Fiddle 上查看

Schema (MySQL v8.0)

CREATE TABLE test (
  id INT,
  date text,
  status INT,
  value INT
);
INSERT INTO test VALUES (1, '01.01.2022', 1, 60);
INSERT INTO test VALUES (2, '01.01.2022', 1, 30);
INSERT INTO test VALUES (3, '01.01.2022', 7, 90);
INSERT INTO test VALUES (1, '02.01.2022', 7, 60);
INSERT INTO test VALUES (2, '02.01.2022', 7, 30);
INSERT INTO test VALUES (3, '02.01.2022', 3, 90);
INSERT INTO test VALUES (1, '03.01.2022', 7, 60);
INSERT INTO test VALUES (2, '03.01.2022', 5, 30);
INSERT INTO test VALUES (3, '03.01.2022', 7, 90);

Query #1

SELECT
ID,
MAX(VALUE) AS VALUE, 
sum(CASE WHEN date = '01.01.2022' THEN status ELSE 0 END) AS '01.01.2022',
sum(CASE WHEN date = '02.01.2022' THEN status ELSE 0 END) AS '02.01.2022',
sum(CASE WHEN date = '03.01.2022' THEN status ELSE 0 END) AS '03.01.2022'
FROM test
GROUP BY ID;
ID VALUE 01.01.2022 02.01.2022 03.01.2022
1 60 1 7 7
2 30 1 7 5
3 90 7 3 7

View on DB Fiddle

SQL时间轴查询

软的没边 2025-01-29 15:54:20

这些数字是< / em>纬度 /经度,但它们与所需的坐标系统不同。您需要使用适当的CRS重新投影数据:

library(sf)
library(ggplot2)
library(ggrepel)

url <- "https://raw.githubusercontent.com/Doc-Midnight/Test_Dir/main/AK_Test2"

ak_test <- source(url)

ak_test <- ak_test$value

ak_test$geometry <- st_transform(ak_test$geometry, "WGS84")

g <- ggplot(ak_test)
g <- g + geom_sf(aes(geometry = geometry, fill = Region), 
                 color = "black", show.legend = FALSE)
g <- g + geom_sf_label(aes(geometry = geometry, label = County))
g + labs(x = "longitude", y = "latitude")

”在此处输入图像描述“

注意,我不知道 geom_sf_label_repel 来自哪里附带问题。

These numbers are latitude / longitude, but they are in a different co-ordinate system from the one you want. You need to re-project the data using an appropriate crs:

library(sf)
library(ggplot2)
library(ggrepel)

url <- "https://raw.githubusercontent.com/Doc-Midnight/Test_Dir/main/AK_Test2"

ak_test <- source(url)

ak_test <- ak_test$value

ak_test$geometry <- st_transform(ak_test$geometry, "WGS84")

g <- ggplot(ak_test)
g <- g + geom_sf(aes(geometry = geometry, fill = Region), 
                 color = "black", show.legend = FALSE)
g <- g + geom_sf_label(aes(geometry = geometry, label = County))
g + labs(x = "longitude", y = "latitude")

enter image description here

Note, I have no idea where geom_sf_label_repel comes from, so I have used non-repeling labels since they are incidental to the question.

使用R中的SF对象将比例更改为LAT/LONG

软的没边 2025-01-29 15:34:34

在您的 vite.config.js 文件中,请确保添加主机:true 。查看 https://vitejs.dev/config/server-options.html

In your vite.config.js file, make sure you add host: true. Check out https://vitejs.dev/config/server-options.html

尝试添加docker映像中的前端vite应用程序

软的没边 2025-01-29 01:41:30

您可以尝试:

  • 在“作者信息:\ n'中将文件的全部内容”检索
  • ,以检索每张纸的信息,
  • 以获取索引1的索引1,以检索摘要,

这是代码:

with open("abstract.txt") as f:
    contents = f.read()

papers = [p for p in contents.split('Author information:\n')]
abstracts = [p.split("\n\n")[1] for p in papers[1:]

它是否有效为你?

You can try:

  • retrieving the whole content of the file as a string
  • splitting on 'Author information:\n', to retrieve infos about every single paper
  • getting the index 1 of your papers, to retrieve the abstracts

Here's the code:

with open("abstract.txt") as f:
    contents = f.read()

papers = [p for p in contents.split('Author information:\n')]
abstracts = [p.split("\n\n")[1] for p in papers[1:]

Does it work for you?

如何在文本文件中提取特定段落并使用Python将其保存在CSV文件中?

软的没边 2025-01-28 22:33:14

这里有几个提示:

  • 使用 $ 快捷方式而不是document.queryselector
  • 使用toggleclass时,请使用前面没有点的类名称。

像这样的事情:

let usercontainer = $(".user-container")
$(".user").on('click', function() {
  usercontainer.toggleClass("active")
}) 

请参阅 https://codepen.io/jr/jr/jr/jr-duboc/pen/pen/pen/pen/pen/nwxeprg

Few tips here:

  • Use the $ shortcut instead of document.querySelector
  • When using toggleClass, use the class name without the dot in front.

Something like this:

let usercontainer = $(".user-container")
$(".user").on('click', function() {
  usercontainer.toggleClass("active")
}) 

See https://codepen.io/jr-duboc/pen/NWXepRG

当我尝试单击元素时

软的没边 2025-01-28 17:20:59

只是为了在这里添加一些值得注意的东西。当不是功能模板时,可以在实现文件中定义模板类的方法。


myqueue.hpp:

template <class T> 
class QueueA {
    int size;
    ...
public:
    template <class T> T dequeue() {
       // implementation here
    }

    bool isEmpty();

    ...
}    

myqueue.cpp:

// implementation of regular methods goes like this:
template <class T> bool QueueA<T>::isEmpty() {
    return this->size == 0;
}


main()
{
    QueueA<char> Q;

    ...
}

Just to add something noteworthy here. One can define methods of a templated class just fine in the implementation file when they are not function templates.


myQueue.hpp:

template <class T> 
class QueueA {
    int size;
    ...
public:
    template <class T> T dequeue() {
       // implementation here
    }

    bool isEmpty();

    ...
}    

myQueue.cpp:

// implementation of regular methods goes like this:
template <class T> bool QueueA<T>::isEmpty() {
    return this->size == 0;
}


main()
{
    QueueA<char> Q;

    ...
}

为什么仅在标题文件中实现模板?

软的没边 2025-01-28 14:24:05

了解 __ str __ __ epr __ 直觉,永久地将它们区分开。

__ str __ 返回给定对象的伪装物体,以使眼睛可读
__ epr __ 返回给定对象的真实肉体(返回本身),以识别不明权。

在一个示例中查看

In [30]: str(datetime.datetime.now())
Out[30]: '2017-12-07 15:41:14.002752'
Disguised in string form

__ epr __

In [32]: datetime.datetime.now()
Out[32]: datetime.datetime(2017, 12, 7, 15, 43, 27, 297769)
Presence in real body which allows to be manipulated directly.

我们可以方便地在 __ epr __ 上进行算术操作。

In [33]: datetime.datetime.now()
Out[33]: datetime.datetime(2017, 12, 7, 15, 47, 9, 741521)
In [34]: datetime.datetime(2017, 12, 7, 15, 47, 9, 741521) - datetime.datetime(2
    ...: 017, 12, 7, 15, 43, 27, 297769)
Out[34]: datetime.timedelta(0, 222, 443752)

如果在 __ str __ 上应用操作,则

In [35]: '2017-12-07 15:43:14.002752' - '2017-12-07 15:41:14.002752'
TypeError: unsupported operand type(s) for -: 'str' and 'str'

除了错误之外,什么都没有返回。

另一个例子。

In [36]: str('string_body')
Out[36]: 'string_body' # in string form

In [37]: repr('real_body')
Out[37]: "'real_body'" #its real body hide inside

希望这可以帮助您建立具体的理由来探索更多答案。

Understand __str__ and __repr__ intuitively and permanently distinguish them at all.

__str__ return the string disguised body of a given object for readable of eyes
__repr__ return the real flesh body of a given object (return itself) for unambiguity to identify.

See it in an example

In [30]: str(datetime.datetime.now())
Out[30]: '2017-12-07 15:41:14.002752'
Disguised in string form

As to __repr__

In [32]: datetime.datetime.now()
Out[32]: datetime.datetime(2017, 12, 7, 15, 43, 27, 297769)
Presence in real body which allows to be manipulated directly.

We can do arithmetic operation on __repr__ results conveniently.

In [33]: datetime.datetime.now()
Out[33]: datetime.datetime(2017, 12, 7, 15, 47, 9, 741521)
In [34]: datetime.datetime(2017, 12, 7, 15, 47, 9, 741521) - datetime.datetime(2
    ...: 017, 12, 7, 15, 43, 27, 297769)
Out[34]: datetime.timedelta(0, 222, 443752)

if apply the operation on __str__

In [35]: '2017-12-07 15:43:14.002752' - '2017-12-07 15:41:14.002752'
TypeError: unsupported operand type(s) for -: 'str' and 'str'

Returns nothing but error.

Another example.

In [36]: str('string_body')
Out[36]: 'string_body' # in string form

In [37]: repr('real_body')
Out[37]: "'real_body'" #its real body hide inside

Hope this help you build concrete grounds to explore more answers.

__STR__和__repr__有什么区别?

软的没边 2025-01-28 02:03:22

如果您只有一个或两个属性需要在对象被视为有效之前需要跟踪,则我将这些属性作为绑定回​​调参数或将其存储在a tuple 临时。然后,我将在 user 无法取消的情况下制作所有内容,然后推迟构建用户对象,直到准备就绪为止。

另外,您可以使所有成员不可删除,初始化临时用户对象设置为哨兵值(例如空字符串),然后替换 user object,稍后再替换。如果这样做,我还会添加断言 s,以检查对象是否在使用之前已完全初始化。 断言 s是对预期逻辑行为的保证和不惩罚生产代码的良好妥协。

If you have only one or two properties that you need to keep track of before the object is considered valid, then I'd pass those around as bound callback arguments or store them in a Tuple temporarily. I'd then make everything in User non-nullable and defer constructing the User object until it's ready.

Alternatively, you could make all members non-nullable, initialize a provisional User object with invalid members set to sentinel values (e.g. empty strings), and then replace the User object later. If you do that, I'd also add asserts to check that the object is fully initialized before being used. asserts are a good compromise between having some assurance for expected logical behavior and not penalizing production code.

用于处理数据库分配的字段(例如标识符)的空安全模式有哪些?

软的没边 2025-01-27 23:01:08

H2 2。*。*无法打开由H2 1.4.200或以上版本创建的数据库文件,您需要将其导出到SQL,并使用用于将这些文件创建到SQL脚本的版本(例如,使用 script to to to 'filename.sql'命令),创建一个带有新版本的H2的新数据库,并使用此脚本中的数据填充它(例如,使用 runscript来自'filename.sql'from_1x >命令)。

另请参阅文档:
https://h2database.com.com.com.com.com/html/html/html/tutorial.html.html#upgradeup_backup_backp_backp_backebackp_restore </

22222 *。*有一个助手类 org.h2.tools.upgrade ,应用程序可以使用它来升级其数据库。

还有一个第三方升级工具:
https://github.com/manticore-projects/h2migrationtool

H2 2.*.* cannot open database files created by H2 1.4.200 or older versions, you need to export them to SQL with the version that was used to create these files into SQL script (for example, with SCRIPT TO 'filename.sql' command), create a new database with the new version of H2 and populate it with data from this script (for example, with RUNSCRIPT FROM 'filename.sql' FROM_1X command).

See also the documentation:
https://h2database.com/html/tutorial.html#upgrade_backup_restore

H2 2.*.* has a helper class org.h2.tools.Upgrade, it can be used by applications to upgrade their databases.

There is also a third-party upgrade tool:
https://github.com/manticore-projects/H2MigrationTool

Intelij H2配置中的错误写入格式1小于支持格式2,Spring Boot应用

软的没边 2025-01-27 19:23:42

你只是有一个错字,第二个维度又是 len(theta) 而不是 len(rho)。还应该

f = np.empty([len(theta), len(rho), len(phi)], dtype=complex)

注意的是,如果我没记错的话,你根本不需要R,它只是rho[i]

You just have a typo, the second dimension is again len(theta) isntead of len(rho). It should be

f = np.empty([len(theta), len(rho), len(phi)], dtype=complex)

Note also that, if I am not mistaken, you don't need R at all, it's just rho[i].

评估半球内点的函数并在 Python 中绘制幻灯片

软的没边 2025-01-27 15:37:11

IP 登录范围按每个 Salesforce 组织设置,并且可以选择按个人资料设置。它们不是通用的,并且与事件日志文件浏览器没有任何特别关系。

您需要与当地 Salesforce 管理员联系,以获取有关您的组织配置的信息。


我最初的回答(上面)并没有反映出“事件日志文件浏览器”是指第三方 Heroku 应用程序的意识。具体问题会很有帮助。

Heroku 应用程序通常根本没有静态 IP 或固定 IP 范围,因此您无法将此应用程序的 IP 包含在允许列表中。为了实现这一点,您需要在 Heroku 私有空间中托管您自己的该应用程序实例(假设它是开源的),该空间确实为网络出口分配了特定的 IP,然后将该 IP 列入允许列表私人空间。请注意,私人空间需要支付大量额外费用。

IP login ranges are set per Salesforce org and optionally per Profile. They are not universal and have nothing in particular to do with the Event Log File browser.

You need to speak with your local Salesforce administrator for information about the configuration of your org.


My initial answer (above) did not reflect awareness that "event log file browser" refers to a third-party Heroku application. It would be helpful to be specific in the question.

Heroku applications in general do not have static IPs or fixed IP ranges at all, so there's no way for you to include this application's IP in an allow list. In order to make that possible, you would need to host your own instance of this application (assuming it is open source) in a Heroku Private Space, which does have specific assigned IPs for network egress, and then allow-list the IPs of that Private Space. Note that Private Spaces come at a substantial additional cost.

我可以知道登录IP范围以访问Salesforce事件日志文件浏览器吗?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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