我很坚强

文章 评论 浏览 28

我很坚强 2025-02-21 01:10:17

您的文件是有效的XML文件。我不知道它的自动转换器,但是很出色,但是可以轻松地将其作为XML文件解析,例如使用BeautifulSoul。

如果内部格式足够简单,则可以处理工作表rowcell标签即可将其转换为CSV文件:

from bs4 import BeautifulSoup
import csv
import io

soup = BeautifulSoup(open('file.xxx'))
    
with open('file.csv', newline='') as fdout:
    wr = csv.writer(fdout)
    sheet = soup.find('worksheet')
    for row in sheet.findAll('row'):
        wr.writerow(cell.text for cell in row.findAll('cell'))

使用您的示例数据,它给出了预期:

Request ID,Date,XXX ID,Customer Name,Amount,Requested Action,Status,Transaction ID,Merchant UTR

Your file is a valid xml file. I know no automatic converter for that but Excel, but it can easily be parsed as a mere xml file, for example with BeautifulSoul.

If the internal format is simple enough, you could just process the Worksheet, row and cell tags to convert it to a csv file:

from bs4 import BeautifulSoup
import csv
import io

soup = BeautifulSoup(open('file.xxx'))
    
with open('file.csv', newline='') as fdout:
    wr = csv.writer(fdout)
    sheet = soup.find('worksheet')
    for row in sheet.findAll('row'):
        wr.writerow(cell.text for cell in row.findAll('cell'))

Using your sample data, it gives as expected:

Request ID,Date,XXX ID,Customer Name,Amount,Requested Action,Status,Transaction ID,Merchant UTR

读取python中包含XML数据的XLS文件

我很坚强 2025-02-21 00:50:32

首先,您的错误意味着decorator @commands.hybrid_command(...) and @app_commands.command() 不能很好地在一起。您要么定义混合命令,斜杠命令或text-chat命令。

下一刻,混合命令具有命令。 >相应的代码 - >从ctx替换交互的用法 contects.contexts.context class,

即替换

  • interaction.user 带有ctx.author
  • Interaction.Channel with ctx.channel
  • Interaction.Send_message with ctx.sendctx.reply

看起来像这样。

@commands.hybrid_command(name='help', with_app_command=True)
async def help(self, ctx: commands.Context, command: Optional[str]):
    ......

    await ctx.send(embed=embed, ephemeral=True)

@help.autocomplete('command')
async def help_autocomplete(self,
                            interaction: discord.Interaction,
                            current: str,
                            ) -> List[app_commands.Choice[str]]:
    .....

PS。建议删除help命令。我建议阅读这个惊人的github gist

First of all, your error means that decorators @commands.hybrid_command(...) and @app_commands.command() do not go well together. You either define hybrid command, slash command or text-chat command.

Next moment, hybrid commands have commands.Context as their argument so we need to replace interaction parameter with that and adjust your ...... code accordingly -> replace usage of interaction with its analogical attributes/methods from ctx of said commands.Context class,

i.e. replace

  • interaction.user with ctx.author
  • interaction.channel with ctx.channel
  • interaction.response.send_message with ctx.send or ctx.reply
  • etc

So your code in user_commands.py would look like this.

@commands.hybrid_command(name='help', with_app_command=True)
async def help(self, ctx: commands.Context, command: Optional[str]):
    ......

    await ctx.send(embed=embed, ephemeral=True)

@help.autocomplete('command')
async def help_autocomplete(self,
                            interaction: discord.Interaction,
                            current: str,
                            ) -> List[app_commands.Choice[str]]:
    .....

PS. it's not advisable to remove help command. I suggest reading this amazing github gist A basic walkthrough guide on subclassing HelpCommand

如何将Discord Bot命令转换为Hybrid命令

我很坚强 2025-02-21 00:17:17

我将您的脚本复制到使用Shebang的文件中,在sudo的前面添加了echo,以显示被执行的命令,并在内部循环后移动一个显示结果。

#! /bin/bash
data_path="https://localhost/public/"
data_name=(PXL_20220628_152928222.mp4 PXL_20220628_163301667.mp4)
for q in "${data_name[@]}"; do
    # data_l=$(sudo mysql -h localhost -P 3306 -u ck****** -p"*******" -e " SELECT iddata FROM ck*****.data WHERE links = '$data_path$q'
    data_l=$(echo "$q")
    echo "$data_l" # this was outside the loop
done
# echo "$data_l" # not here, this only reports the LAST value

运行它:

PXL_20220628_152928222.mp4
PXL_20220628_163301667.mp4

您是在分配它,但没有报告它,然后用第二个任务覆盖它,并且仅报告循环完成后的一个。

只需在循环内的末端移动回声即可。

I copied your script to a file with a shebang, added an echo in front of the sudo to show the command being executed and moved the one AFTER the loop inside to show the result.

#! /bin/bash
data_path="https://localhost/public/"
data_name=(PXL_20220628_152928222.mp4 PXL_20220628_163301667.mp4)
for q in "${data_name[@]}"; do
    # data_l=$(sudo mysql -h localhost -P 3306 -u ck****** -p"*******" -e " SELECT iddata FROM ck*****.data WHERE links = '$data_path$q'
    data_l=$(echo "$q")
    echo "$data_l" # this was outside the loop
done
# echo "$data_l" # not here, this only reports the LAST value

Running it:

PXL_20220628_152928222.mp4
PXL_20220628_163301667.mp4

You were assigning it, but not reporting it, then overwriting with the second assignment, and only reporting that one after the loop was done.

Just move the echo at the end inside the loop.

循环,数组,mysql,bash,linux

我很坚强 2025-02-20 16:29:21

您所要做的就是在taglist周围使用样式和输入标签:

tagList(
        tags$style(paste0("#", ns("numinput"), "{background-color: ", color, " !important;})")),
        autonumericInput(ns("numinput"),
                         label = label,
                         value = val(),
                         align = "right")
      )

在您的代码中,样式标签实际上未在<<<代码> uioutput ,仅返回自动杀伤力。

我用这种更改对其进行了测试,并且有效。

All you have to do is use tagList around the style and input tags:

tagList(
        tags$style(paste0("#", ns("numinput"), "{background-color: ", color, " !important;})")),
        autonumericInput(ns("numinput"),
                         label = label,
                         value = val(),
                         align = "right")
      )

In your code, the style tag was not actually output in the uiOutput, only the autonumericinput was returned.

I tested it with this change and it works.

动态UI输入元件的背景颜色在光泽模块中

我很坚强 2025-02-20 11:45:03

[标识符]是一个NCHAR(128),引起了落后空间。

[identifier] was a nchar(128) causing trailing spaces.

SQL如何删除落后空间?

我很坚强 2025-02-19 23:07:37

AWS计算器的每月基数约为5xX美元,而Azure VM + SQL托管DB的每月为$ 4xx。如果您的长期托管希望,我建议您购买SQL Server的专有许可。它将节省更多!

It will be around $5xx USD per month base on AWS calculator, and $4xx per month for Azure VM + SQL managed Db. If your desire long-term hosting, i will suggest you purchase a proprietary license of SQL server. It will save more!

For reference : One EC2+One SQL Server

AWS网站托管.NET/SQL-初学者

我很坚强 2025-02-19 23:05:49

只有具有Express或HTTP接口的某些方法才会发送响应。一些方法,例如.status().append().cookie()仅在外发响应上设置状态当响应实际发送时 - 他们实际上并没有发送响应本身。因此,当使用这些方法时,您必须使用一些实际发送响应的方法(例如.end()

在您的具体示例中:

response.status(204)

您可以使用真正发送响应的Express版本:

response.sendStatus(204)

如果您选择使用.status()而不是Express Documentation,则必须与其他一些导致响应发送的方法。以下是 express文档 for .status(status)( )

res.status(403).end()
res.status(400).send('Bad Request')
res.status(404).sendFile('/absolute/path/to/404.png')

由于所有这三种其他方法都将导致响应发送,并且当响应熄灭时,它将选择先前设置的状态。

Only certain methods with Express or the http interface will send the response. Some methods such as .status() or .append() or .cookie() only set state on the outgoing response that will be used when the response is actually sent - they don't actually send the response itself. So, when using those methods, you have to follow them with some method that actually sends the response such as .end().

In your specific example of:

response.status(204)

You can use the Express version that actually sends the response:

response.sendStatus(204)

If you choose to use .status() instead, then from the Express documentation, you have to follow it with some other method that causes the response to be sent. Here are examples from the Express documentation for .status():

res.status(403).end()
res.status(400).send('Bad Request')
res.status(404).sendFile('/absolute/path/to/404.png')

Since all three of these other methods will cause the response to be sent and when the response goes out, it will pick up the previously set status.

为什么我们需要将.end()添加到响应中?

我很坚强 2025-02-19 15:55:42

它应该是

`seq 100 100 1000`

'seq 100 100 1000'是字面的。

It should be

`seq 100 100 1000`

'seq 100 100 1000' is literal.

如何编写运行自定义程序的BASH脚本?

我很坚强 2025-02-19 14:14:57

您需要清除浮子。

.clearfix:after {
  content:"";
  display:block;
  clear:both;
}

将该类添加到&lt; img&gt;

示例的contrate div中:

.clearfix:after {
  content: "";
  display: block;
  clear: both;
}

.square {
  width: 100px;
  height: 100px;
  background: yellow;
}
before
<div class="square"></div>
after
<hr> before
<div class="clearfix">
  <div class="square" style="float:right"></div>
</div>

after
<hr> before
<div class="square" style="float:right"></div>
after
<hr>

You need to clear the float.

.clearfix:after {
  content:"";
  display:block;
  clear:both;
}

add that class to a containing div for the <img>

Example:

.clearfix:after {
  content: "";
  display: block;
  clear: both;
}

.square {
  width: 100px;
  height: 100px;
  background: yellow;
}
before
<div class="square"></div>
after
<hr> before
<div class="clearfix">
  <div class="square" style="float:right"></div>
</div>

after
<hr> before
<div class="square" style="float:right"></div>
after
<hr>

CSS:如何直接对齐图像而不切入底部?

我很坚强 2025-02-19 12:48:38

就是这样:

const ref = collection(db, `chats/${router.query.id}/messages`)
const q = query(ref, order('timestamp', 'asc'))
const snapshot = await getDocs(q)
if(snapshot.exits()) console.log(snapshot.docs)

It's something like that:

const ref = collection(db, `chats/${router.query.id}/messages`)
const q = query(ref, order('timestamp', 'asc'))
const snapshot = await getDocs(q)
if(snapshot.exits()) console.log(snapshot.docs)

将firebase v8升级为v9

我很坚强 2025-02-19 05:49:50
sed '/^>/s/\.[^ ]* / /'

每行以a'&gt;”开头更换“点”,然后是与空间不同的炭,然后是空间。

sed '/^>/s/\.[^ ]* / /'

for each line starting with a '>' replace 'dot' followed by some char different from spaces followed by a space, by a space.

从两个字符之间的fasta基因名称中删除文本

我很坚强 2025-02-18 21:29:24

问题解决了。谢谢您的答复,向我确认这是一个配置问题,而不是列出的net 6。有趣的是,如果您转到 @ibrennan208发布的文档API链接,然后向下滚动到该部分,则仅列出框架版本,这让我想知道是否被抛弃。意识到我可以在WPF项目后面的视图代码中看到该类的款项,这让我感到放心,这是一个配置问题。我想使用该类的视图模型是在我的汇编项目中。修复程序:添加usewpf标签并将设置为true在汇编项目的propertygroup标签中

Problem solved. Thank you for your replies which confirmed to me that it was a config issue rather than the class being left out of .NET 6. Interestingly if you go to the docs api link posted by @ibrennan208 and scroll down to the Applies To section, it only lists framework versions which made me wonder if ditched. Realising I could see the class from my View’s code behind in my wpf project reassured me it was a config issue. The View Model in which I wanted to use the class was in my assembly project. The fix: add UseWPF tag and set to true in assembly project’s PropertyGroup tag

IcollectionView是由.NET 6支持的,还是在MVVM中有过滤列表的替代方法?

我很坚强 2025-02-18 19:34:25

只需在结果查询中使用hashmap?

Map<String, retailvisitkpi__c> mapOfItems = new Map<String, retailvisitkpi__c>();

这将根据访问场所ID删除所有重复项

Just use hashmaps with the resulting query?

Map<String, retailvisitkpi__c> mapOfItems = new Map<String, retailvisitkpi__c>();

That will remove all the duplicates based on the Visit Place ID

soql Group by in Salesforce

我很坚强 2025-02-18 11:06:42

我建议您首先对软件包管理器进行干净的重新安装,缺少Python依赖性。然后,您可以运行nvm install -lts,它将是您想要的V16。

I recommend you first do a clean reinstall of the package manager, a python dependency is missing. Then you can run nvm install --lts which would be the v16 you would like.

使用NVM更新节点版本

我很坚强 2025-02-17 19:02:41

在C:

double bPow = 1;
double sum = 0
double b = a * a;

for (int i = 0; i < n; i++)
{
    bPow *= b;
    sum += 1 / bPow;
}

这为您提供了X = [2,4,...,2n]的所有1/A^X的总和。

In C:

double bPow = 1;
double sum = 0
double b = a * a;

for (int i = 0; i < n; i++)
{
    bPow *= b;
    sum += 1 / bPow;
}

This gives you the sum of all 1/a^x for x = [2, 4, ..., 2n] .

如何在不使用电源函数的情况下有效地找到(1/a^2x)的总和?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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