所有问题

0 投票
0 回答
41 浏览

python - 如何在 python 中访问嵌套的 JSON 属性?

如何访问我的请求负载中的描述字段?

请求有效载荷:

我尝试了几种方法,但没有奏效。

尝试1:

输出:

尝试2:

输出:

它显示所有字段,但我只需要描述字段。

有效载荷的图像:

0 投票
1 回答
19 浏览

sql - 用于显示评估列值结果的 SQL 选项

我有一个如下所示的表格

源客户 ID 有税收优惠 有抵押品 有贷款
100021
100022 是的
100023 是的
100024 是的 是的
100025 是的
100026 是的 是的
100027 是的 是的
100028 是的 是的 是的

在使用 select 语句时,预期的输出。

源客户 ID 二元税收优惠 二元抵押品 二元贷款
100021 0 0 0
100022 0 0 1
100023 0 1 0
100024 0 1 1
100025 1 0 0
100026 1 0 1
100027 1 1 0
100028 1 1 1

逻辑是每一列都有一个二进制等价物,如果列的值为“否”,它们的值为 0。否则“是”。我该如何实施?

0 投票
1 回答
22 浏览

javascript - 根据 React/MaterialUI 中的单击项目显示/隐藏 JSON 信息

我正在根据我拥有的 JSON 文件创建一个常见问题解答部分,该文件包含一组带有“问题”和“答案”的对象。在此处输入图像描述 它设置为当您单击左侧的问题时,它会在右侧显示相应的答案...确实可以正常工作。问题是当用户再次单击该问题并且该部分不起作用时,我想隐藏数据。当我再次单击一个问题时,它会更改图标,但不会更改右侧的框。当再次单击问题时,我希望答案框完全消失。

我猜这是我在设置状态时做错的事情:

0 投票
3 回答
39 浏览

r - 匹配两个数据框的两列之间的值并使用另一个值创建一个新列

我有下面的2个数据框

我想在其中匹配值n$namee$id然后在其中创建一个新列groupn其中包含如下所示的相应值e$group

0 投票
0 回答
22 浏览

javascript - 为什么这个承诺然后在代码沙箱中执行两次?

为什么 console.log(props.name + " promise" + i);记录两次?

代码在这里

0 投票
1 回答
22 浏览

reactjs - 路由器为每个路由路径渲染相同的组件

对于这两个路径反应只渲染着陆组件。对于路径“/”和路径“/home”也是如此。路由器只渲染登陆组件。

0 投票
1 回答
57 浏览

python - Tkinter 按钮 - 按下时用新信息替换旧信息

需要帮助解决这个问题,我是一个为此疯狂的初学者。每次按下“pingButton1”时,我都希望“pingResult1”刷新信息,而不是每次按下时都添加新信息。这是一个简单的“检查 ping 是否良好”程序。

有什么建议么?

堆叠

我试过使用谷歌,但没有什么对我有用。

我猜我需要这样的东西

0 投票
0 回答
162 浏览

docker - Docker 容器高磁盘使用率

我正在虚拟机上使用 docker-compose 运行一些 docker 映像。当我启动这些容器时,它们使用了大约 55MB:

大约一周后,我收到了一些关于虚拟机磁盘空间不足的警告,我发现这些容器消耗了大约 122GB 的磁盘空间!

我多次遇到这个问题,直到我发现并使用它docker container prune来删除它们。

我在 docker-compose 中为卷使用本地路径,并将该路径指向与 root( /) 不同的分区上的某个磁盘。这是我的 docker-compose 的示例:

0 投票
1 回答
107 浏览

reactjs - 警告:列表中的每个孩子都应该有一个唯一的“关键”道具。在反应。实际上数组有一个键

我不知道为什么会发生这个错误。“项目”每个都有一个键。

编码

0 投票
1 回答
284 浏览

javascript - 如何在日期之间禁用角度材料日期选择器

我想在两个日期之间禁用选定的角度材料。例如,用户不能选择 和 之间的任何 2021-03-02日期2011-03-02

我写了这段代码:

但它没有用。

演示

有什么问题 ?我该如何解决这个问题???

0 投票
1 回答
26 浏览

javascript - 使用JS中的按钮从数组中随机选择一个推送值

我有以下代码:

此代码允许某人在输入中输入一个值并将其添加到数组中。我想创建另一个按钮,它允许用户随机选择他添加到(空)数组中的一个值。

我尝试了以下代码,但此代码显示了用户添加的所有内容,并且不会随机选择一个:

0 投票
1 回答
34 浏览

php - PHP组合多维数组

我有以下数组。

我想组合上面的数组,使其形成一个看起来像这样的数组。

到目前为止,我正在使用 foreach 循环遍历属性并在每个属性中附加房屋类型,如下所示:

但是我要回来的数组不太正确。这是我要回来的数组。

如何正确合并这样的数组,谢谢。

0 投票
1 回答
45 浏览

firebase - Error "The method '[]' was called on null. Receiver: null Tried calling: []("0tm2JqPY0oNq5vSM74BqOufhGao1")"

I am getting this error in the poll post Page after added the voting feature to it:

The new method I added is handleTotalVotePosts to handle the count of userPostPolls(in line number 178). I think the error is getting the userId or something which i am not Sure .

I am not sure what is actually wrong here

But code seems to be correct

Please help me to get out of this bug. Thank you :)

0 投票
2 回答
63 浏览

python - Why is Google Colab taking so long for learning these simple neural networks?

I'm trying to run the followin code on google colab:

You can check it here.

I've done on my laptop 1 run on a jupyter notebook, instead of the 21, and the part where it's slowest is in the 'for' block, but that's to be expected.

The code compiles without error, since I've already managed to run it for 5 cycles/simulations without problems.

However, it's taking a very long time... I wonder why it is. Isn't google colab supposed to use GPU(or TPU) when learning neural networks with keras? I've already changed the Runtime type to GPU or TPU, and it's still very slow.

0 投票
1 回答
32 浏览

r - 基于组将数据添加到数据框

我正在处理生物信息学数据,每行都有一个基因,列中有统计信息/元数据。一些基因来自同一生物体,由“ID”列指示,我将数据分组在这个变量上。

我想根据 ID(分组因子)添加来自另一个文件的数据,以便 ID = a 的行应该具有来自名为 a.gff 的文件的数据,依此类推。我想添加的数据来自一个包含基因位置的 .gff 文件。有一个 ID=a 的 gff 文件,一个 ID=b 的文件,一个 ID=c 的文件,等等根据 ID 命名(例如“a.gff”)。

数据是什么样子的:

基因 ID
赛拉 一个
细胞 一个
Atl b
prT 一个
胡尔 C

有没有办法实现为每个 ID 分组打开文件、执行操作并移动到下一个 ID 的功能?

我对 R 很陌生,非常感谢任何帮助!

0 投票
1 回答
57 浏览

elasticsearch - Search through all document fields (nested and root document) in one multi match query

Let's assume these basic documents as an example:

I need to find the first document with a search term like pants stripes blue 38. All terms should be connected with AND as I'm not interested in pants with dots or other size and color combinations.

My mapping looks like this:

Please ignore the fact that I'm using german stop words and such. I kept the example files above in english so that everyone can understand it but didn't adjust the mapping as the original example is in german.

So ideally what I want my query to look like is this:

And the Search Profiler from Kibana show that the query will be executed like this:

Which looks to be exactly what I need in terms of AND and OR logic. Search through every attribute with every term and connect those results with AND. So every search term needs to be in one of the fields but it doesn't matter in which it was found.

But this query seems to only search inside the nested documents. In fact it seems like each query can only search through nested objects or the root document. Not both at the same time. If I remove the nested part the Search Profiler shows the difference:

Results in:

Both queries return zero results.

So my question is if there is a way to make the above query work and to be able to truly search across all defined fields (nested and root doc) within a multi match query on a term by term basis.

I would like to avoid doing any preprocessing to the search terms in order to split them up based on them being in a nested or root document as that has it's own set of challenges. But I do know that this is a solution to my problem.

Edit The original files have a lot more attributes. The root document might have up to 250 fields and each nested document might add another 20-30 fields to it. Because the search terms need to search through lot of the fields (possibly not all) any sort of concatenation of nested and root document attributes to make them "searchable" seems unpractical.

A flattened index might be a practical solution. By that I mean copying all root documents fields to the nested document and only indexing the nested docs. But in this question I would like to know if it also works with nested objects without modifying the original structure.

0 投票
1 回答
33 浏览

elasticsearch - 如何在 Elasticsearch 中对不同的记录进行分组

我的 Elasticsearch 索引中有以下数据:

现在我想在id.

预期的输出是:

我尝试了一个聚合查询,但它只给了我计数。另外,我想在我的回复中包含最新记录。

  1. 如何从 Elasticsearch 中获取按 ? 分组的排序的、唯一的记录id
  2. 我想要最新插入的数据
0 投票
1 回答
25 浏览

php - PHP:在运行查询之前首先收集所有错误

有什么方法可以检查文件上传是否会出错?就像放置一个变量以了解每个 else 语句是否有错误,以便在它阻止运行查询之前。因为即使在移动/复制/删除文件时出现错误,它仍然会运行查询。

0 投票
1 回答
332 浏览

node.js - 如何在 Heroku 应用程序中设置环境变量

所以我目前正在做一个需要数据库的副项目。我选择选择 MongoDB。我安装了 dotenv 包,所以我可以使用它来保存我的秘密 mongoDB 连接字符串。

我想将我的应用程序部署到 Heroku,但我当然不想为此将我的 .env 推送到 github 存储库。有没有办法解决?这是一个heroku-git repo,但我不知道这会有多安全。关于如何保持连接字符串保密并将应用程序推送到像 Heroku 这样的平台的任何其他想法?

0 投票
1 回答
43 浏览

android - ConstraintLayout 中的 ListView 在预览中展开为全屏

我正在尝试包含ListViewConstraintLayoutAndroid Studio 中。但是,如果我没有指定边距,则视图会在设计预览中扩展到全屏。并且该constraintBottom_toTopOf参数在某些情况下无济于事。这是IDE的错误还是这是一种ListView工作方式?我是否能够限制ListView它在另一个视图的顶部之前结束,尽管它的大小并且没有指定较大的边距?

这是 XML 代码:

设计预览:

ListView 填满所有空间

0 投票
1 回答
156 浏览

c# - Outlook shows save confirmation dialog (message lose digital signature in case of saving) in Application.ItemSend event handler

I'm developing Outlook VSTO add-in that checks Outlook.MailItem attachments. As far as I need to get access to internals of OLE and .msg file (embedded)attachments, I use glue with C++ Extended MAPI.
I received digitally signed message and when I'm trying to reply the save confirmation dialog is showing (with caption - "...If the changes are saved, the message will lose its digital signature."). This behavior repeats only when I'm trying to make reply for digitally signed message. In the code below add-in call Save() for Outlook.MailItem (saves it into Drafts folder by default and after that MailItem obtains EntryID), set Cancel=true and make some long work with attachments in another thread and if the work result is ok, add-in call MailItem.Send() programmatically. Obviously this dialog shows when mailItem.Save() was called. But without mailItem.Save() call, I can't to obtain attachment type (PR_ATTACH_METHOD through GetProps or HrGetOneProp return NO_ATTACHMENT) in C++ part.

My question - how to suppress or get around this dialog?

0 投票
2 回答
40 浏览

python - Input statements just keep going in a loop

Hi i am albert i am learning python, in this block of code i wrote i intend it to print the total, but the input statements just keep going in a loop

0 投票
1 回答
27 浏览

node.js - yauzl callback parameter is undefined in one computer, works fine in another

I'm trying to do

when zipfile is supposed to be of type ZipFile

On one computer everything is fine, on the other one I keep getting undefined.

The only differences between the too is that I downloaded the yauzl module using npm install yauzl then copied the node_modules folder + the package.json & package-lock.json to the second computer (it's offline so I cant directly install onto it)

It never did any problems up until now, and when I tried copying the entire project back to the first computer from the second computer it works!

Any idea?

Pictures for references:

On the first computer (working one): enter image description here

On the second computer (not working one): enter image description here

PS The null on this picture is the options object and zipfile still shows up as undefined even with something in it.

0 投票
1 回答
47 浏览

python - 通过 HTTP 提供图像时损坏的图像

我在读取图像文件(.png、.jpg、.jpeg ...)时遇到问题,在终端中出现以下错误: UnicodeDecodeError: the 'utf-8' codec cannot decode the 0x89 byte in position 0 : invalid起始字节。我以为我已经通过声明 o_file = open ("cloud.png", "rb") 解决了这个问题,因为根据示例我不再在终端中收到错误,而是在查看文件 (cloud.png) 时出现错误以下:

在此处输入图像描述

我想知道为什么会发生这种情况以及如何在不使用第三方模块的情况下解决这个问题?下面是不使用python正常打开的文件的预览:

在此处输入图像描述

0 投票
0 回答
82 浏览

hybris - 如何在 hybris 中为 OAuth2 响应设置会话超时

要求是为spartacus店面中的购物车设置超时。我试图通过在 local.properties 中将值设置为oauth2.refreshTokenValiditySeconds=1000来实现,但它不起作用。有什么办法可以做到这一点。