谈场末日恋爱

文章 评论 浏览 26

谈场末日恋爱 2025-02-20 13:55:19

假设您 conc/3 谓词是 附加/3 ,然后:

cutlast( Xs, Ys ) :- conc(L2,[_],L1) .

Assuming that you're conc/3 predicate is a home-brew version of append/3, then:

cutlast( Xs, Ys ) :- conc(L2,[_],L1) .

我只想知道如何定义以下谓词

谈场末日恋爱 2025-02-20 09:55:18

据说,< button onClick = {handlecart(product)}> cart</button> 在这里有故障,因为您是 nes nater function 您写 handlecart(product)。这将重新构成组件,因此无限循环。

OnClick 需要功能定义。因此,您需要写信:

onClick={() => handlecart(product)}

基本上,告诉它该怎么做,不要做。

As it has been said, <button onClick={handlecart(product)}>cart</button> is at fault here, because your are calling the function when you write handlecart(product). This rerenders the component, hence the infinite loop.

onClick needs a function definition. So you need to write:

onClick={() => handlecart(product)}

Basically, tell it what to do, not to do it.

如何在React中修复此无限循环

谈场末日恋爱 2025-02-19 19:13:20

您可以使用 itertools :: Interleave 交织到前进并扭转迭代器。

  • rangeclusive&lt; i32&gt; 不实现 extcertSizedIterator ,因此没有 .len()函数。我们必须自己计算。
  • 如果该范围的长度为奇数,则额外的项目将在(LEN + 1)的情况下显示在前半半。
let range = 0..=63;
let len = range.end() - range.start() + 1;
let iter = itertools::interleave(
    range.clone().take((len + 1) / 2),
    range.clone().rev().take(len / 2),
);

You could use itertools::interleave to interleave forward and reverse iterators.

  • RangeInclusive<i32> doesn't implement ExactSizedIterator so there's no .len() function. We have to calculate it ourselves.
  • If the range has an odd length the extra item will show up in the forward half thanks to (len + 1).
let range = 0..=63;
let len = range.end() - range.start() + 1;
let iter = itertools::interleave(
    range.clone().take((len + 1) / 2),
    range.clone().rev().take(len / 2),
);

Playground

如何从头开始将迭代器与迭代器相互交流?

谈场末日恋爱 2025-02-18 20:01:11

使用:

where = (df['col2'].str.isdigit(), 'col2')
df.loc[where] = df.loc[where].str.lstrip('0')

Use:

where = (df['col2'].str.isdigit(), 'col2')
df.loc[where] = df.loc[where].str.lstrip('0')

删除熊猫列中的领先零,但仅用于数字

谈场末日恋爱 2025-02-17 20:35:39

您将钥匙混合在一起,并在最内向的循环中进行价值。

foreach ($data as $authors) {
  foreach ($authors as $author) {
    foreach ($author as $key => $value) {
      if ($key !== 'id') {
        echo $value . "\n";
      }
    }
  }
}

注1:我将$ id重命名为$作者,因为那是:作者详细信息的数组。

注2:如果您缩短此行:

foreach ($array as $key => $value)

to:

foreach ($array as $xxxx)

xxxx将携带$ value零件,而不是$键部分,则是:

foreach ($array as $value)   // foreach ($array as $key) does not work

You mixed up key and value in the innermost loop.

foreach ($data as $authors) {
  foreach ($authors as $author) {
    foreach ($author as $key => $value) {
      if ($key !== 'id') {
        echo $value . "\n";
      }
    }
  }
}

Note 1: I renamed $id to $author, because that is what it is: an array of the author's details.

Note 2: If you shorten this line:

foreach ($array as $key => $value)

to:

foreach ($array as $xxxx)

xxxx will carry the $value part, not the $key part, so it is:

foreach ($array as $value)   // foreach ($array as $key) does not work

可以将键与PHP数组中的另一键进行比较

谈场末日恋爱 2025-02-17 09:05:57

创建Excel文件

import pandas as pd
import numpy as np

# creating and saving excel file
df = pd.DataFrame(
    np.random.randint(0, 10, size=(10, 4)),
    columns=['column name 1', 'column name 2',
             'column name 3', 'column name 4']
)
writer = pd.ExcelWriter('test_file.xlsx')
df.to_excel(writer, sheet_name='my_sheet', index=False)
writer.save()

更改列和行的大小

import pandas as pd

df = pd.read_excel('test_file.xlsx')
writer = pd.ExcelWriter('test_file.xlsx')
df.to_excel(writer, sheet_name='my_sheet', index=False)

worksheet = writer.sheets['my_sheet']

# change column width of all columns
worksheet.set_column(0, len(df),  30)

# change row height
for row in range(0, len(df.index)+1):
    worksheet.set_row(row, 20)

writer.save()

之前,

之后

参考

https://xlsxwriter.readthedocs.io/worksheet.html

您可能还想看看 this 以动态更改行高度和列宽度,

Creating excel file

import pandas as pd
import numpy as np

# creating and saving excel file
df = pd.DataFrame(
    np.random.randint(0, 10, size=(10, 4)),
    columns=['column name 1', 'column name 2',
             'column name 3', 'column name 4']
)
writer = pd.ExcelWriter('test_file.xlsx')
df.to_excel(writer, sheet_name='my_sheet', index=False)
writer.save()

Changing size of columns and rows

import pandas as pd

df = pd.read_excel('test_file.xlsx')
writer = pd.ExcelWriter('test_file.xlsx')
df.to_excel(writer, sheet_name='my_sheet', index=False)

worksheet = writer.sheets['my_sheet']

# change column width of all columns
worksheet.set_column(0, len(df),  30)

# change row height
for row in range(0, len(df.index)+1):
    worksheet.set_row(row, 20)

writer.save()

Before

enter image description here

After

enter image description here

Reference

https://xlsxwriter.readthedocs.io/worksheet.html

You might also want to take a look at this to dynamically change the row height and column width

谈场末日恋爱 2025-02-17 08:16:17

该代码不是来自Bing的AI,但是AI给出了一个很好的描述:

为了创建一个安全的字符串,用于从PowerShell连接到SQL Server,您可以使用转换converts-securestring cmdlet。
这将创建一个安全的字符串对象,可用于将密码存储在PowerShell脚本中。然后,您可以使用此对象创建一个可以连接到SQL Server的PSCREDential对象。
然后,您可以使用此凭据对象使用SQLConnection类连接到SQL Server。
这将创建一个连接对象,该对象使用指定的凭据连接到SQL Server。然后,您可以使用此连接对象对数据库执行SQL命令。

$cred = Get-Credential

#Initialize connection string
$connString = "Data Source=$SQLServer; Initial Catalog=$SQLDBName"

#Create a SQL connection object
$conn = New-Object System.Data.SqlClient.SqlConnection $connString
$conn.Credential = $cred

#Attempt to open the connection
$conn.Open()
if($conn.State -eq "Open")
{
    # We have a successful connection here
    # Notify of successful connection
    Write-Host "Test connection successful"
    $conn.Close()
} 

The code did not come from Bing's AI, but the AI gave a nice description:

To create a secure string for connection to SQL Server from PowerShell, you can use the ConvertTo-SecureString cmdlet.
This will create a secure string object that can be used to store the password in a PowerShell script. You can then use this object to create a PSCredential object, which can be used to connect to SQL Server.
You can then use this credential object to connect to SQL Server using the SqlConnection class.
This will create a connection object that uses the specified credentials to connect to SQL Server. You can then use this connection object to execute SQL commands against the database.

$cred = Get-Credential

#Initialize connection string
$connString = "Data Source=$SQLServer; Initial Catalog=$SQLDBName"

#Create a SQL connection object
$conn = New-Object System.Data.SqlClient.SqlConnection $connString
$conn.Credential = $cred

#Attempt to open the connection
$conn.Open()
if($conn.State -eq "Open")
{
    # We have a successful connection here
    # Notify of successful connection
    Write-Host "Test connection successful"
    $conn.Close()
} 

无法使用安全密码通过PowerShell连接到SQL Server

谈场末日恋爱 2025-02-17 06:16:41

您完全做错了男人,这不是迭代python词典的方式。如果有模式,则可以直接删除这样的值,然后可以将数据转储到文件中。

import json
with open('jsontest.json', 'r+') as f:
    data = json.load(f)
    print("Orignal Data: ",data)
    del data['collections']['tags']['2GvAB3TrWwJSdDeAdg4R']['id']
    del data['collections']['tags']['2GvAB3TrWwJSdDeAdg4R']['__collections__']
    print("Updated Data: ",data)

you are completely doing it wrong man, this is not the way to iterate over a dictionary in python. if you have the schema you can directly delete the values like this too and after that you can dump data to file.

import json
with open('jsontest.json', 'r+') as f:
    data = json.load(f)
    print("Orignal Data: ",data)
    del data['collections']['tags']['2GvAB3TrWwJSdDeAdg4R']['id']
    del data['collections']['tags']['2GvAB3TrWwJSdDeAdg4R']['__collections__']
    print("Updated Data: ",data)

尝试从JSON文件中删除键/值时,我会得到str&#x27;对象没有属性&#x27; pop&#x27;/&#x27; del&#x27;

谈场末日恋爱 2025-02-17 01:38:55

您可以尝试在每项活动中添加这些行的下方,并查看是否有效

AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);

You Can try adding these line just below onCreate method in each and every activity and see if it works

AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);

在Android API级别上禁用Darkmode&lt; 29(q)

谈场末日恋爱 2025-02-16 23:27:26

这里的关键概念是属性可见性。 Cmake中有两种类型:

  1. 私有:属性会影响正在构建的目标。
  2. 接口:该属性会直接或通过 target_link_libraries(... interface ...)直接或过渡地链接到的目标。

public 可见性只是两个 的速记。


所以。酒吧的构建应该看起来像:

add_library(Bar SHARED bar.cpp)
target_link_libraries(Bar PUBLIC Foo)

我们在此处使用 public 可见性,因为酒吧的标题包括foo的标头。也就是说,链接到Bar的库也需要了解FOO。

现在,我们像这样构建foo:

add_library(Foo SHARED foo.cpp)
target_include_directories(Foo PUBLIC "
lt;BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>")

魔术的主要位是 $&lt; build_interface:...&gt; Generator Expression。这样可以防止当您最终使用 install(导出)创建 find_package -compatible cmake时,可以防止包含目录(这是通往构建计算机某个地方的绝对路径)。这些库的包装。

否则,我们只是依靠 $ {cmake_current_source_dir}/.. 将从 foo bar (以及任何东西)传播。链接到 bar ),因为此路径位于接口 foo 的接口中。

The key concept here is property visibility. There are two types in CMake:

  1. PRIVATE: the property affects the target being built.
  2. INTERFACE: the property affects targets that link to this one directly, or transitively through target_link_libraries(... INTERFACE ...).

The PUBLIC visibility is simply a shorthand for both.


Therefore. the build for Bar should look like so:

add_library(Bar SHARED bar.cpp)
target_link_libraries(Bar PUBLIC Foo)

We use PUBLIC visibility here because Bar's headers include Foo's headers. That is, libraries linking to Bar need to know about Foo as well.

Now we build Foo like so:

add_library(Foo SHARED foo.cpp)
target_include_directories(Foo PUBLIC "
lt;BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>")

The main bit of magic here is the $<BUILD_INTERFACE:...> generator expression. This prevents the include directory (which is an absolute path to somewhere on your build machine) from being exported when you eventually use install(EXPORT) to create a find_package-compatible CMake package for these libraries.

Otherwise, we're just relying on the fact that ${CMAKE_CURRENT_SOURCE_DIR}/.. will be propagated from Foo to Bar (and anything that links to Bar) because this path is in the INTERFACE of Foo.

使用CMAKE在一个项目中包括并访问多个.SO文件和标题

谈场末日恋爱 2025-02-16 21:30:02

如何解决这个到期的问题,因为DocuSign端点不提供Refresh_token?

最好的是为每次docuSign的呼叫创建一个新的JWT,并使用软件而不是网站来创建一个新的JWT。

注意:仅在旧的访问令牌过期或即将到期时获得新的访问令牌(通过发送新的JWT)获得新的访问令牌(通过发送新的JWT)。

DocuSign SDK包括创建JWT的功能。所有SDK都是开源的,因此,如果您不想整体使用SDK,则可以复制功能的实现。

How to solve this expiring issue as DocuSign endpoint does not provide a refresh_token?

The best is to create a new JWT for each OAuth call to DocuSign--and use software, not a website, to do so.

Note: Only obtain a new access token (by sending a fresh JWT) when the old access token has expired or is about to expire.

The DocuSign SDKs include functions to create a JWT. All of the SDKs are open source, so if you don't want to use the SDK as a whole, you can copy out the functions' implementations.

JWT:如何在不使用JWT.IO的情况下续订JWT

谈场末日恋爱 2025-02-16 18:36:11

将您的样式文件命名为“ style.css”,将style.css放在拥有 *.html文件和HTML文件粘贴的同一文件夹中:

<link rel="stylesheet" type="text/css" href="./style.css" />

您的问题是由通往CSS的错误路径引起的

Name your styles file "style.css", put style.css to the same folder where you have your *.html file and inside html file paste this line:

<link rel="stylesheet" type="text/css" href="./style.css" />

Your issue is caused by wrong path to css

外部CSS背景图像

谈场末日恋爱 2025-02-16 17:30:35

这项工作

<template>
  <div>
    <p v-if="$fetchState.pending">Fetching products...</p>
    <p v-else-if="$fetchState.error">An error occurred :(</p>
    <div v-else>
      <h1>Nuxt products</h1>
      <ul>
        <li v-for="product in products" :key="product.id" :img="product.img">
          {{ product.description }}
        </li>
      </ul>
      <button @click="$fetch">Refresh</button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      products: [],
    };
  },
  async fetch() {
    const response = await this.$axios.$get('https://dummyjson.com/products')
    this.products = response.products
  },
}
</script>

您需要 v-for =“产品中的产品” 如下所述: https://vuejs.org/guide/essentials/list.html

此外,关于网络请求

”

我们可以像往常一样看到,实际数据在 data ,因此您可以使用 $ get 快捷方式: https://axios.nuxtjs.org/usage#-shortcuts

然后,您需要访问 products 字段才能将数据进行迭代。使用Vue DevTools +网络选项卡极大地有助于调试该选项卡!

This works

<template>
  <div>
    <p v-if="$fetchState.pending">Fetching products...</p>
    <p v-else-if="$fetchState.error">An error occurred :(</p>
    <div v-else>
      <h1>Nuxt products</h1>
      <ul>
        <li v-for="product in products" :key="product.id" :img="product.img">
          {{ product.description }}
        </li>
      </ul>
      <button @click="$fetch">Refresh</button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      products: [],
    };
  },
  async fetch() {
    const response = await this.$axios.$get('https://dummyjson.com/products')
    this.products = response.products
  },
}
</script>

You need v-for="product in products" as explained here: https://vuejs.org/guide/essentials/list.html

Also, regarding the the network request

enter image description here

We can see that as usual, the actual data is inside data, hence you can use the $get shortcut: https://axios.nuxtjs.org/usage#-shortcuts

Then you need to access the products field to have the data to iterate on. Using the Vue devtools + network tab greatly helps debugging that one!

如何迭代NUXT中的对象集合(数组)?

谈场末日恋爱 2025-02-16 08:12:01

如果您只想在匹配电子邮件中拥有相同的ID:

MERGE INTO test_table tt
USING (SELECT MIN(ID)
            , email
         FROM test_table 
        GROUP BY email) mails
   ON (tt.email = mails.email)
 WHEN MATCHED THEN UPDATE SET tt.id = mails.id;

If you just want to have the same id for the matching emails:

MERGE INTO test_table tt
USING (SELECT MIN(ID)
            , email
         FROM test_table 
        GROUP BY email) mails
   ON (tt.email = mails.email)
 WHEN MATCHED THEN UPDATE SET tt.id = mails.id;

有重复的标识符值时如何更新具有不同值的列

谈场末日恋爱 2025-02-16 07:54:14

使用NPM:

CMD [ "npm", "run", "start" ]

检查Docker容器上的过程图

$ ps ajxf
 PPID   PID  PGID   SID TTY      TPGID STAT   UID   TIME COMMAND
    0     1     1     1 pts/0        1 Ssl+     0   0:01 npm run start
    1    19     1     1 pts/0        1 S+       0   0:00 sh -c -- node server.js
   19    20     1     1 pts/0        1 Sl+      0   0:00  \_ node server.js

npm Process Shawns a shell Process,然后催生 node process。这意味着 npm 不会将 node 作为直接儿童产生。

导致 npm 进程无法将信号传递给 node 进程。

这与 npm 在本地的行为不同,在 node

process

CMD [ "node", "server.js" ]

$ ps ajxf
 PPID   PID  PGID   SID TTY      TPGID STAT   UID   TIME COMMAND
    0     1     1     1 pts/0        1 Ssl+     0   0:00 node server.js

node.js并非被设计为PID 1,这会导致在Docker内部运行时出乎意料的行为。例如,以PID 1运行的节点。

解决方案:

CMD [ "bash", "-c", "node server.js" ]

或使用 Tini / s6 init System

with NPM:

CMD [ "npm", "run", "start" ]

check the process graph on docker container

$ ps ajxf
 PPID   PID  PGID   SID TTY      TPGID STAT   UID   TIME COMMAND
    0     1     1     1 pts/0        1 Ssl+     0   0:01 npm run start
    1    19     1     1 pts/0        1 S+       0   0:00 sh -c -- node server.js
   19    20     1     1 pts/0        1 Sl+      0   0:00  \_ node server.js

the npm process shawns a shell process, which then spawns the node process. This means that npm does not spawn the node process as a direct child.

causes the npm process to fail to pass signals to the node process.

this is different than how npm behaves locally, where it spawns the node process directly.

with node

CMD [ "node", "server.js" ]

process graph

$ ps ajxf
 PPID   PID  PGID   SID TTY      TPGID STAT   UID   TIME COMMAND
    0     1     1     1 pts/0        1 Ssl+     0   0:00 node server.js

Node.js was not designed to run as PID 1 which leads to unexpected behaviour when running inside of Docker. For example, a Node.js process running as PID 1 will not respond to SIGINT (CTRL-C) and similar signals

solution:

CMD [ "bash", "-c", "node server.js" ]

Or use the tini/s6 init system

NPM的问题开始启动Docker中的节点应用程序

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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