我刚刚在我的笔记本电脑上安装了 linux mint 22.1 cinnamon,并使用命令“apt install python3-library”安装了 pygame 和 pyqt5。我在下载 pylrc 时写了这段代码,但是没有用——它说没有这样的包。
该怎么办?我应该换一种写法吗?
我刚刚在我的笔记本电脑上安装了 linux mint 22.1 cinnamon,并使用命令“apt install python3-library”安装了 pygame 和 pyqt5。我在下载 pylrc 时写了这段代码,但是没有用——它说没有这样的包。
该怎么办?我应该换一种写法吗?
我正在使用 Vue 3、Vite 编写一个小网站。我有一个组件Holidays
,可以显示特定一天(今天)的假期列表。
<script setup lang="ts">
import { computed } from 'vue'
import { getCurrentDay, getCurrentMonth, getHolidaysByDate } from '@/utils'
const today = new Date()
const currentDay = getCurrentDay(today)
const currentMonth = getCurrentMonth(today)
const currentHolidays = computed(() => getHolidaysByDate(currentDay, currentMonth))
</script>
<template>
<div class="holidays-list gc-font-body">
<template v-if="currentHolidays.length > 0">
<div
v-for="(holiday, index) in currentHolidays"
:key="index"
:class="['holiday', index === 0 ? 'holiday-important' : '']"
>
<div class="holiday-title">{{ holiday.title }}</div>
<div class="gc-font-gray">{{ holiday.description }}</div>
</div>
<div class="holiday holiday-additional gc-font-body-m gc-font-gray gc-align-center">
Посмотреть все
</div>
</template>
<div v-else class="gc-font-body gc-font-gray gc-align-center">
К сожалению, мы не нашли информацию о праздниках в этот день. Если у вас есть предложение
по добавлению праздника, пожалуйста, нажмите на кнопку «Добавить праздник» в шапке сайта.
</div>
</div>
</template>
ChatGPT 为我提供了这种逻辑的确切实现,其中computed
只有currentHolidays
。然而,在各种来源中,并且定期地,同一个 ChatGPT 建议我将变量包装today
在ref
—中const today = ref(new Date())
,并将所有后续变量包装在 中computed
。从逻辑上讲,内容每天在页面重新加载时更新一次。据我所知,“computed
当您需要跟踪变量的变化,然后执行计算或其他操作(取决于跟踪的变量)时建议使用,其结果将以另一个变量的形式存储。”
我想更详细地了解这一点。
代码:
#include <iostream>
main() {
int i = 1;
int j = 1;
for (i; i < 10; i++) {
for (j; j < 10; j++) {
std::cout << (i * 10 + j) * (i * 10 + j) << " ";
}
std::cout << std::endl;
}
}
我想输出一个从 10 到 99 的平方表,但是出现错误:“缺少类型说明符 - 假定为 int。注意:C++ 默认不支持 int。”
小项目ASP .Net Web API
,bd postgresql
。
该数据库booksdb
是在管理面板中手动创建的。有一张桌子books
,位于shemas.public
。手动添加了几行数据(QueryTool
也可以通过管理面板中的界面)
语境:
public class BookStoreDbContext : DbContext
{
public BookStoreDbContext(DbContextOptions<BookStoreDbContext> options)
: base(options)
{
}
public DbSet<BookEntity> Books { get; set; }
}
连接字符串:
"ConnectionStrings": {
"BookStoreDbContext": " ......User ID=postgres;Database=booksdb;"
错误:
项目正在正确构建。
没有前端,我使用 Swagger,它应该返回模拟数据字符串。
错误前调试:
该库可以从外部访问,例如从 Python:
import psycopg2
conn = psycopg2.connect(dbname="books1db",
host="127.0.0.1",
user="postgres",
password="my_password",
port="5432")
cursor = conn.cursor()
query = "SELECT * FROM books"
cursor.execute(query)
result = cursor.fetchall()
cursor.close()
conn.close()
for row in result:
print(row)
关于这个错误有很多记载(例如),但所有情况都是(1)代码中数据库创建不正确(2)代码中查询不正确。 “不正确”是因为大小写不正确,或者括号和引号不正确,或者必须通过模式名称访问表。就我而言,这些都不存在。
该问题特定于版本 v2。 v1 工作正常,但无法与第二个版本连接。我们无法获取第一个授权码。一切看上去都符合文献记载,尽管它极其歪曲。我将用 Python 发布代码。谁能告诉我。错误 error_description":"ESIA-007053: OAuthErrorEnum.clientSecretWrong
def sign_params_for_v2_by_csptest(client_secret_raw):
"""
:param client_secret_raw: Сформированный для подписания файл
:return:
"""
thumbprint = ""
tmp_dir = tempfile.gettempdir()
source_file = tempfile.NamedTemporaryFile(mode='w', delete=False, dir=tmp_dir)
source_file.write(client_secret_raw)
source_file.close()
source_path = source_file.name
destination_path = source_path + ".sig"
cmd = (f'/opt/cprocsp/bin/amd64/csptest -keys -sign GOST12_256 -cont "имя контейнера" -keytype exchange -in {source_path} -out {destination_path}')
os.system(cmd)
signed_message = open(destination_path, 'rb').read()
os.unlink(source_path)
os.unlink(destination_path)
"""
Возвращает base64url подписанное значение
"""
return base64.urlsafe_b64encode(signed_message).decode('utf-8')
TIMESTAMP = get_timestamp()
CLIENT_ID = "имя"
SCOPE = "openid"
SCOPE_ORG = "org_inn"
REDIRECT_URI = "урл"
SERVICE_URL = "https://esia-portal1.test.gosuslugi.ru/aas/oauth2/v2/ac"
STATE = str(uuid.uuid4())
#Формируем client для подписания
client_secret_raw = (
CLIENT_ID +
SCOPE.replace(" ", "") +
SCOPE_ORG +
TIMESTAMP +
STATE +
REDIRECT_URI
)
client_secret = sign_params_for_v2_by_csptest(client_secret_raw)
client_hash = "hash через calc_cert_hash_unix"
params_url = {
"client_id": CLIENT_ID,
"scope": SCOPE,
"scope_org": SCOPE_ORG,
"timestamp": TIMESTAMP,
"state": STATE,
"redirect_uri": REDIRECT_URI,
"client_secret": client_secret,
"response_type": "code",
"access_type": "offline",
"client_certificate_hash": client_hash,
}
params = urlencode(sorted(params_url.items()))
url = f"{SERVICE_URL}?{params}"
print("URL:", url)