我注意到的第一件事是,您的结果类将尝试绑定到称为“数据”的属性,如JSON字符串所示,应称为“数据”。
Based on the json string I think you should try to deserialize to:
public partial class Result
{
public ArastirmaRaporListesiResult ArastirmaRaporListesiResult { get; set; }
}
public partial class ArastirmaRaporListesiResult
{
public Datum[] Data { get; set; }
public long ErrorCode { get; set; }
public object ErrorMessage { get; set; }
public long StatusCode { get; set; }
}
public partial class Datum
{
public string Baslik { get; set; }
public string DosyaAd { get; set; }
public string EnstrumanKod { get; set; }
public string KategoriAd { get; set; }
public string KategoriKod { get; set; }
public long RaporId { get; set; }
public string RaporTarih { get; set; }
public string Url { get; set; }
}
For reference I used https://app.quicktype.io /生成课程
有两个错误,第一个是在初始化的语法中,
__init__ Not _init_
第二个错误是您应该作为输入输入根。
最后,您将其更改一些,以将初始化与其他方法分开。
from tkinter import*
from tkinter import ttk
from PIL import Image, ImageTk
class Face_Recognization_System:
def __init__(self, root):
self.root = root
def change(self):
self.root.title("Simple Prog")
self.root.geometry("1530x790+0+0")
if __name__ == "__main__":
root = Tk()
obj = Face_Recognization_System(root)
obj.change()
root.mainloop()
在几个地方使用了过多的内存,但是方法中的所有内容除了返回的 int []
是可收集的垃圾,因此您不应有任何疑虑。
但是,如果您以许多值阅读 - 说100,000或更多,那么以下建议将减少所需的内存足迹。
主张 ArrayList
在使用前避免重新分配时:
int initialSize = 100000;
ArrayList<Integer> innt = new ArrayList<>(initialSize);
避免每次解析 Integer
避免使用StringBuffer。由于 int
具有最大长度,因此您可以替换为 final char [] dourus
:
final char[] doubus = new char[Integer.toString(Integer.MAX_VALUE).length() + 2];
int dIndex = 0;
// ... Then append with:
if (a != '|') {
doubus[dIndex++] = a;
} else {
innt.add(Integer.valueOf(new String(doubus, 0, dIndex)));
dIndex=0;
}
使用 integer.valueof
用 arraylist&lt; integer&gt; 表示您将自动键入许多
int
值作为整数,仅在末尾提取为 int
。将 arraylist
交换为 int []
并使用 integer.parseint
,因此结果始终是原始类型 int
是指避免了许多内存转换:
int [] innt = new int[initialSize];
int iIndex = 0;
// Replace add with:
innt[iIndex++] = Integer.parseInt(new String(doubus, 0, dIndex));
将其放在一起您应该具有相同的输出,希望记忆力减少:
public static int[] findDoub(File file) throws IOException {
int initialSize = 100000; // Use suitable value
int [] innt = new int[initialSize];
int iIndex = 0;
try (BufferedInputStream buff = new BufferedInputStream(new FileInputStream(file))) {
int index = buff.read();
final char[] doubus = new char[Integer.toString(Integer.MAX_VALUE).length() + 2];
int dIndex = 0;
for (int i = 0; index != -1; i++) {
char a = (char) index;
if (i > 0) {
if (a != '|') {
doubus[dIndex++] = a;
} else {
// Grow int[] if needed:
if (iIndex == innt.length) {
innt = Arrays.copyOf(innt, innt.length + initialSize);
}
innt[iIndex++] = Integer.parseInt(new String(doubus, 0, dIndex));
dIndex=0;
}
}
index = buff.read();
}
}
// Return exact size int[] of current length:
return Arrays.copyOf(innt, iIndex);
}
您将获得一个数字,可以通过减去距离该group_id的总数到目前为止的总数的次数来区分Group_ID的值的时间。一点点想法会向您展示此值在相同值的系列中始终相同,并且与在不同时间出现的相同值始终不同。
从该数字中,您可以计算您的顺序截面号。可能有一种直接执行此操作的方法(以较少的子查询),但是我必须使用一个中间步骤来获得group_id的特定值运行的日期。
SELECT id, group_id, date, value,
dense_rank() over (partition by group_id order by group_value_incidence_start) section
FROM (
SELECT id, group_id, date, value,
min(date) over (partition by group_id, value, group_value_incidence) group_value_incidence_start
FROM (
SELECT id, group_id, date, value,
count(1) over (partition by group_id order by date) -
count(1) over (partition by group_id, value order by date) group_value_incidence
FROM test
) group_value_indidences
) group_value_incidence_starts
ORDER BY group_id, section
您是发送字符串而不是JSON,这就是为什么Elasticsearch表示它不喜欢收到的数据的原因。
尝试在没有 json.stringify
的情况下执行请求:
app.get("/import/data", async (req, res) => {
const current = {
project_name: "java",
delivery_manager: "Yawhe",
project_manager: "Ruth",
};
await axios({
url: "http://localhost:9200/sales-enable-data-index/_doc",
method: "POST",
headers: {
"Content-Type": "application/json",
},
auth: {
username: "username",
password: "password",
},
body: current,
})
.then((response) => {
return res.status(200).send(response);
})
.catch((err) => {
return res.status(500).send(err);
});
});
要将.crt转换为.pfx,我们需要托管提供商提供的CSA证书(私钥)。以下是转换以下步骤:
-
下载并根据您的下面的链接下面安装OpenSSL软件
系统类型 https://slproweb.com/products/win32222openssl.html.html.html - 在命令提示符上以下命令:
openssl pkcs12 -export -Out证书
或
openssl pkcs12 -export -Out证书
-in
.pfx -inkey
privateKey.txt > cacert.crt = networksolutions_ca.crt
证书.pfx
是生成文件的新名称。
privateKey
可以在中.key
或 .txt
格式
完成此过程后,我们拥有 cetide.pfx
文件,因此转到IIS Manager中的IIS服务器证书。
右侧有一个导入链接按钮,单击此,然后选择转换后的证书,然后输入在创建 .pfx
文件时输入的密码,然后完成该过程。
现在,在IIS上选择您的站点,然后右键单击此网站,选择“编辑绑定”,然后在“新弹出窗口”上选择 https://
和“ hosting name”是您的域名和所有其他字段就是这样,单击确定以完成此过程。
现在,重新启动IIS,您的证书在您的网站上正常工作。
编辑
中包含的方法
import { encode } from 'querystring'
// From useRouter:
// const { query } = useRouter()
// From GetServerSidePropContext
// const { query } = ctx
const urlQueryString = encode(query)
const searchParams = new URLSearchParams(urlQueryString )
简单的方法:使用 encode/stringify
lib lib旧答案
,或者您可以使用这些助手方法将查询参数从一种类型转换为另一种类型为另一种类型一种非常简单的方法。
export function parsedUrlQueryToURLSearchParams(
query: ParsedUrlQuery
): URLSearchParams {
const searchParams = new URLSearchParams()
for (const [key, value] of Object.entries(query)) {
if (!value) continue
if (Array.isArray(value)) {
value.forEach((element) => {
searchParams.append(key, element)
})
} else {
searchParams.append(key, value)
}
}
return searchParams
}
export function urlSearchParamsToParsedUrlQuery(
searchParams: URLSearchParams
): ParsedUrlQuery {
const query: ParsedUrlQuery = {}
for (var [key, value] of searchParams.entries()) {
query[key] = value
}
return query
}
如果需要
export function parsedUrlQueryToURLString(query: ParsedUrlQuery): string {
const params = []
for (const [key, value] of Object.entries(query)) {
if (!value) continue
if (Array.isArray(value)) {
value.forEach((element) => {
params.push(`${key}=${encodeURIComponent(element)}`)
})
} else {
params.push(`${key}=${encodeURIComponent(value)}`)
}
}
return params.join('&')
}
我只想补充说,我花了一个星期的时间将Babel和其他软件包降级到2018年以前的软件包,只是意识到我的问题是在我自己的代码中具有助手功能,该功能是为恶意的HTML代码过滤。
@lifeisfoo提到弦乐'?&lt;!'上面在node_modules中,但我建议还要将整个项目盖住。
仅供参考,我打破野生动物园的我的言论是'&lt; =!'。这也是一个不受支持的外观
我在Safaris Regex Tester中测试了我的正则:(?&lt; =![)(。*?)(?=]) https://www.regextester.com/ 输出说“ LookBehind在JavaScript中不支持”
要结束,我发现Safaris Console错误消息毫无价值,并在bundledle.js的10,000行中传播,给人的印象是问题在包装/依赖关系中,这显然不是。
我花了很长时间才降级包装,只是在捆绑包代码的不同行上发现了相同的错误消息。
这要简单得多。首先只需使用 css transition 对于动画而言(您只需要一个类)。通过添加 data-progress =“ x”
来调整输入,其中 x
是每个选择贡献的进度量。您的脚本只需要收听更改
事件,然后总结所有已检查的项目' data-progress
值,然后使用它来设置宽度。
$(document).ready(function() {
const $radios = $('input[type="radio"]')
$radios.change(function() {
let progress_value = 0
$('input[type="radio"]:checked').each(function() {
progress_value += Number($(this).data('progress'))
})
console.log(progress_value)
$(".progress-value").width(progress_value + '%')
});
// trigger change on one to register any pre-checked values
$($radios[0]).change()
})
body {
padding: 12px;
}
.col-6 label {
border: 1px solid #333;
}
.col-6 input[type=radio]:checked+label {
border: 2px solid blue;
}
.progress {
background: rgba(255, 255, 255, 0.1);
justify-content: flex-start;
border-radius: 100px;
align-items: center;
position: relative;
display: flex;
height: 10px;
width: 100%;
margin-bottom: 10px;
}
.progress-value {
box-shadow: 0 10px 40px -10px #fff;
border-radius: 100px;
background: #0d6efd;
height: 30px;
width: 0;
transition: width 2s;
}
<head>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
</head>
<body>
<div class="wrappy">
Speed
<div class="progress">
<div class="progress-value"></div>
</div>
</div>
<div class="row">
<label>Group 1</label>
<div class="col-6">
<input type="radio" style="display:none;" id="js1" data-price="146.99" value="option1a" name="ONE" data-progress="50" checked>
<label for="js1" onclick="">
Option 1a (Default 50%)
</label>
</div>
<div class="col-6">
<input type="radio" style="display:none;" id="js2" data-price="123.99" value="option2a" name="ONE" data-progress="75">
<label for="js2" onclick="">
Option 2a (75%)
</label>
</div>
<hr style="margin-top:24px;">
<label>Group 2</label>
<div class="col-6">
<input type="radio" style="display:none;" id="js3" data-price="116.99" value="option1b" name="TWO" data-progress="0">
<label for="js3" onclick="">
Option 1b (Default 50%, but if option 2a selected then stay 75%)
</label>
</div>
<div class="col-6">
<input type="radio" style="display:none;" id="js4" data-price="93.99" value="option2b" name="TWO" data-progress="10">
<label for="js4" onclick="">
Option 2b (Should increase from group 1 selection)
</label>
</div>
</div>
<!-- bootstrap.bundle.min.js belongs down here after all the content, just before the closing body tag -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</body>
它发送文件 csv
,因此您不需要
您可以使用 io
与 pandas.read_csv()
import requests
import pandas as pd
import io
url = 'https://droughtmonitor.unl.edu/DmData/GISData.aspx/?mode=table&aoi=county&date=2022-06-21'
response = requests.get(url)
fh = io.StringIO(response.text) # create file in memory
df = pd.read_csv(fh)
print(df)
或您可以使用Module CSV
import requests
import csv
import io
url = 'https://droughtmonitor.unl.edu/DmData/GISData.aspx/?mode=table&aoi=county&date=2022-06-21'
response = requests.get(url)
fh = io.StringIO(response.text) # create file in memory
data = list(csv.reader(fh))
print(data)
编辑:
您甚至可以直接使用 url
pandas 代码>
import pandas as pd
url = 'https://droughtmonitor.unl.edu/DmData/GISData.aspx/?mode=table&aoi=county&date=2022-06-21'
df = pd.read_csv(url)
print(df)
编辑:
现在,您只需要使用日期列表,然后运行 -loop的才能读取所有CSV并保持列表。稍后,您可以使用
pandas.concat()
将此列表转换为单个 dataframe
。
pandas doc: Merge
“示例:
import pandas as pd
# --- before loop ---
all_dates = ["2022-06-21", "2022-06-14", "2022-06-07"]
all_dfs = []
# url without `2022-06-21` at the end
url = 'https://droughtmonitor.unl.edu/DmData/GISData.aspx/?mode=table&aoi=county&date='
# --- loop ---
for date in all_dates:
print('date:', date)
df = pd.read_csv( url + date )
all_dfs.append( df )
# --- after loop ---
full_df = pd.concat(all_dfs)
print(full_df)
要获取日期列表,您可以从网页上刮擦它们,但可能需要 selenium 而不是而不是<代码> BeautifulSoup 因为页面使用JavaScript在页面上添加日期。
或者,您应该使用 devtools
(TAB:网络
,filter: xhr
)查看JavaScript使用的URL来获取日期并使用请求
获取它们。
import requests
# without header `Content-Type` it sends `HTML` instead of `JSON`
headers = {
# 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:98.0) Gecko/20100101 Firefox/98.0',
# 'X-Requested-With': 'XMLHttpRequest',
# 'Referer': 'https://droughtmonitor.unl.edu/DmData/GISData.aspx/',
'Content-Type': 'application/json; charset=utf-8',
}
url = 'https://droughtmonitor.unl.edu/DmData/GISData.aspx/ReturnDMWeeks'
response = requests.get(url, headers=headers)
#print(response.text)
data = response.json()
all_dates = data['d']
all_dates = [f"{d[:4]}-{d[4:6]}-{d[6:]}" for d in all_dates]
print(all_dates)
结果
['2022-06-21', '2022-06-14', '2022-06-07', ..., '2000-01-18', '2000-01-11', '2000-01-04']
如果我正确理解问题,您有两个选项:
-
从
Inbisup
元素中删除intactive
类(这足以使其可见)。您可以选择将活动
类添加到 -
您更新
active> active
样式从显示:block
display:block!重要;
给出一个更高的优先级,并覆盖intactive
类仍在元素上(不推荐)
我认为,如果数据库关闭,则不应重新启动您的应用程序,它应该等待数据库节点重新启动并重新连接。这就是为什么数据库健康不是生计检查的一部分,而只是准备就绪的一部分。准备就绪将掩盖服务请求的一部分,应用程序将等待数据库重新在线。重新启动应用程序节点将对应用程序的生计没有影响。
有点不清楚为什么您从2844047记录中选择(
从薪水中选择计数(*)
),然后将结果数乘以365(现有年度的每天),从而导致1038077155+记录的临时结果(+
,因为有些一年的时间超过365天...)。最后,您正在计算avg_salary
,在当年的365天中,这总是相同的。我确实认为无需为所有单个日期生成_eries,并且此查询应给出正确的结果:
在上述查询中,我没有从_date和/或to_date中选择,因为这将作为您的待办事项
It is, a bit unclear why you are selecting from 2844047 records (
select count(*) from salaries
), and multiplying the number of results by 365 (for every day in the existing year), resulting in a temporary result of 1038077155+ records (+
, because some year have more than 365 days...). Finally you are calculating theavg_salary
, which will always be the same for all of the 365 days in that year.I do think there is no need to generate_series for all individual dates, and this query should give the correct results:
In above query I did not select from_date and/or to_date, because that will be left as a TODO for you ????
Results of above query:
EDIT:
First you need to get the salary of an employee with the correct starting date and ending date, this deals with changing functions somewhere during the year
example output (with the WHERE enabled):
When you want to know the average salary on 1996-01-01, you can do:
output:
P.S. There is one small error in this, because the to_date is the same as the start_date. I did not handle this in this script.
SQL:匹配日期范围