您可以使用 cjson
。使用此实用程序来解析您的JSON:
https://github.com/subhendushekhar/cjson
也有其他功能。
我承认,将这些数据分别发送到函数的想法完全不同。
但是要直接返回值 aaaaaaaa
:
- 将第一个参数发送为JSON对象值
- 将第二个参数发送为JSON对象名称字符串
- 将第三个参数发送为键列表,
然后您可以使用 eval()
将字符串联合转换为代码:
def my_function(json_full, json_prefix, json_field):
my_json = json_full
my_json_str = json_prefix
key_field = '["' + '"]["'.join(json_field) + '"]'
try:
value = eval(f'{json_prefix}{key_field}')
return value
except Exception as e:
return e
def main():
my_json = {
"DataChangedEntry": {
"CurrentValue": {
"RefId": {
"Value": "aaaaaaa"
},
},
},
}
get_value = my_function(my_json, 'my_json', ["DataChangedEntry","CurrentValue","RefId","Value"])
print(get_value)
if __name__ == "__main__":
main()
输出:
aaaaaaa
上使用Regex
创建扩展名
extension RegexExt on String {
bool validateEmail() => RegExp(
r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
.hasMatch(this);
}
您可以在字符串用法
String emailValidator(String email, BuildContext context) {
if (email == null || email.length == 0) {
return AppLocalizations.of(context).translate('validators.requiredField');
}
return email.validateEmail() ? null : AppLocalizations.of(context).translate('validators.invalidEmail');
}
根据“ nofollow noreferrer”> tramplast_control_control_protocol wikipedia on wikipedia:
序列号(32位)
具有双重角色:
如果设置了SYN标志(1),则这是初始序列号。实际的第一个数据字节的序列编号和相应的ACK中的已确认数字为此序列编号加1。
如果SYN标志是清晰的(0),则这是当前会话的第一个段字节的累积序列编号。
和根据史蒂文斯的 tcp ip所示,第1卷:
每个TCP段(在连接建立期间交换的TCP段)
包括有效的序列号字段, ack号或确认字段和a 窗口大小字段(包含窗口广告)。
现在,让我们构建一个方案并使用 tcpdump
跟踪TCP段:
- 初始化http(IE TCP)请求,
curl
:
$ curl -iIL https://blog.codefarm.me/
HTTP/2 200
server: GitHub.com
.....
- 同时,执行
tcpdump
并将转储日期写入文件如下:
tcpdump -n port 443 -r /tmp/https.pcap
- 使用以下命令读取转储数据:
$ tcpdump --number -ntS port 443 -r /tmp/https.pcap
reading from file /tmp/https.pcap, link-type EN10MB (Ethernet), snapshot length 262144
1 IP 192.168.91.128.32868 > 185.199.108.153.443: Flags [S], seq 2427498844, win 64240, options [mss 1460,sackOK,TS val 2733586448 ecr 0,nop,wscale 7], length 0
2 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [S.], seq 1574645920, ack 2427498845, win 64240, options [mss 1460], length 0
3 IP 192.168.91.128.32868 > 185.199.108.153.443: Flags [.], ack 1574645921, win 64240, length 0
4 IP 192.168.91.128.32868 > 185.199.108.153.443: Flags [P.], seq 2427498845:2427499362, ack 1574645921, win 64240, length 517
5 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [.], ack 2427499362, win 64240, length 0
6 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [P.], seq 1574645921:1574650508, ack 2427499362, win 64240, length 4587
7 IP 192.168.91.128.32868 > 185.199.108.153.443: Flags [.], ack 1574650508, win 61320, length 0
8 IP 192.168.91.128.32868 > 185.199.108.153.443: Flags [P.], seq 2427499362:2427499442, ack 1574650508, win 62780, length 80
9 IP 192.168.91.128.32868 > 185.199.108.153.443: Flags [P.], seq 2427499442:2427499488, ack 1574650508, win 62780, length 46
10 IP 192.168.91.128.32868 > 185.199.108.153.443: Flags [P.], seq 2427499488:2427499537, ack 1574650508, win 62780, length 49
11 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [.], ack 2427499442, win 64240, length 0
12 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [.], ack 2427499488, win 64240, length 0
13 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [.], ack 2427499537, win 64240, length 0
14 IP 192.168.91.128.32868 > 185.199.108.153.443: Flags [P.], seq 2427499537:2427499640, ack 1574650508, win 62780, length 103
15 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [.], ack 2427499640, win 64240, length 0
16 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [P.], seq 1574650508:1574651050, ack 2427499640, win 64240, length 542
17 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [P.], seq 1574651050:1574651109, ack 2427499640, win 64240, length 59
18 IP 192.168.91.128.32868 > 185.199.108.153.443: Flags [.], ack 1574651109, win 62780, length 0
19 IP 192.168.91.128.32868 > 185.199.108.153.443: Flags [P.], seq 2427499640:2427499671, ack 1574651109, win 62780, length 31
20 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [.], ack 2427499671, win 64240, length 0
21 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [P.], seq 1574651109:1574651502, ack 2427499671, win 64240, length 393
22 IP 192.168.91.128.32868 > 185.199.108.153.443: Flags [P.], seq 2427499671:2427499695, ack 1574651502, win 62780, length 24
23 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [.], ack 2427499695, win 64240, length 0
24 IP 192.168.91.128.32868 > 185.199.108.153.443: Flags [F.], seq 2427499695, ack 1574651502, win 62780, length 0
25 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [.], ack 2427499696, win 64239, length 0
26 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [FP.], seq 1574651502:1574651526, ack 2427499696, win 64239, length 24
27 IP 192.168.91.128.32868 > 185.199.108.153.443: Flags [R], seq 2427499696, win 0, length 0
第11-13行中的数据包都是ACK段,而无需palyload。 tcpdump
还没有显示 seq
应该为 1574650508
作为带有有效负载的最后一个发送段(即来自服务器的有效负载)行号6)。
为什么?
现在,让我们运行 tcpdump
带有以下选项:
$ tcpdump --number -ntSxx port 443 -r /tmp/https.pcap
.....
6 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [P.], seq 1574645921:1574650508, ack 2427499362, win 64240, length 4587
.....
11 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [.], ack 2427499442, win 64240, length 0
0x0000: 000c 298c df3f 0050 56e9 f627 0800 4500
0x0010: 0028 5a0e 0000 8006 9e38 b9c7 6c99 c0a8
0x0020: 5b80 01bb 8064 5ddb 428c 90b0 b3b2 5010
0x0030: faf0 0b70 0000 0000 0000 0000
12 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [.], ack 2427499488, win 64240, length 0
0x0000: 000c 298c df3f 0050 56e9 f627 0800 4500
0x0010: 0028 5a0f 0000 8006 9e37 b9c7 6c99 c0a8
0x0020: 5b80 01bb 8064 5ddb 428c 90b0 b3e0 5010
0x0030: faf0 0b42 0000 0000 0000 0000
13 IP 185.199.108.153.443 > 192.168.91.128.32868: Flags [.], ack 2427499537, win 64240, length 0
0x0000: 000c 298c df3f 0050 56e9 f627 0800 4500
0x0010: 0028 5a10 0000 8006 9e36 b9c7 6c99 c0a8
0x0020: 5b80 01bb 8064 5ddb 428c 90b0 b411 5010
0x0030: faf0 0b11 0000 0000 0000 0000
.....
实际上,使用 xx
选项,我们可以分析32位序列号(IE 5DDDB 428C
)上述TCP段(11-13),然后将其转换为小数号如下:
$ echo $((16#5ddb428c))
1574650508
在这里,我们可以看到ACK段中重复三次重复的序列编号为 1574650508
与Wireshark相同(使用绝对序列编号选项)。
在释放模式下,两种两项方法的IL主体都是相同的。
IL_0014: ldc.i4.2
IL_0015: newarr [System.Runtime]System.Int32
IL_001a: dup
IL_001b: ldc.i4.0
IL_001c: ldloc.0
IL_001d: stelem.i4
IL_001e: dup
IL_001f: ldc.i4.1
IL_0020: ldloc.1
IL_0021: stelem.i4
IL_0022: ret
在调试模式下,只有另外2个Opcodes。首先,该方法的主体;
IL_001c: ldc.i4.2
IL_001d: newarr [System.Runtime]System.Int32
IL_0022: dup
IL_0023: ldc.i4.0
IL_0024: ldloc.0
IL_0025: stelem.i4
IL_0026: dup
IL_0027: ldc.i4.1
IL_0028: ldloc.1
IL_0029: stelem.i4
IL_002a: stloc.3
IL_002b: br.s IL_0058
第二个示例;
IL_001c: ldc.i4.2
IL_001d: newarr [System.Runtime]System.Int32
IL_0022: dup
IL_0023: ldc.i4.0
IL_0024: ldloc.0
IL_0025: stelem.i4
IL_0026: dup
IL_0027: ldc.i4.1
IL_0028: ldloc.1
IL_0029: stelem.i4
IL_002a: stloc.3
IL_002b: ldloc.3 // Pushes local variable, returnArr to the 3rd index of the evaluation stack.
IL_002c: stloc.s 4 // Pops latest pushed value from evaluation stack
IL_002e: br.s IL_005c
在发布模式下,由于编译器的优化没有差异,因此没有任何差异。
在调试模式下,第二代码将变量推到堆栈,然后再次弹出,因此无论如何它都应该慢速运行。
要获得更准确的结果,您应该使用基准库,例如 benchmarkDotnet ,应该运行数百万或数十亿或数十亿或数十亿或数十亿的基准方法时间并获得平均/平均时间。
我能够下载2.6.0如下
sudo curl -L https://github.com/docker/compose/releases/download/v2.6.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
您可以做这样的事情。
from api4jenkins import Jenkins
j = Jenkins('http://localhost:8080', auth=('admin', 'admin'))
job = j['Sample'] # Getting the Job by name
for line in job.get_build(1).console_text():
print(line)
还请记住,总是有可能直接下载日志。例如,请参考以下内容。
http:// localhost:8080/job/< jobname>/lastSuccessfulbuild/consoletext
您可以这样做,使用香草JS
<table class="button-box3">
<thead>
<tr >
<th>vatId</th>
<th>Desc</th>
<th>MPK</th>
<th>Quantity</th>
<th>Vat </th>
<th>Kwota Brutto</th>
<th>Wartosc Netto</th>
<th>Wartosc Brutto</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr id="vatek" class="active-row">
<td>1</td>
<td>xx</td>
<td>Stychurski</td>
<td>Manager</td>
<td>21.04.2020</td>
<td>20</td>
<td >2022</td>
<td>20</td>
<td>
<a href="#" type="button" class="submit-btn3">Change</a>
</td>
</tr>
<tr class="row">
<td>1</td>
<td>xx</td>
<td>Stychurski</td>
<td>Manager</td>
<td>21.04.2020</td>
<td>20</td>
<td >100</td>
<td>20</td>
<td>
<a href="#" type="button" class="submit-btn3">Change</a>
</td>
</tr>
<tr class="row">
<td>1</td>
<td>xx</td>
<td>Stychurski</td>
<td>Manager</td>
<td>21.04.2020</td>
<td>20</td>
<td >3000</td>
<td>20</td>
<td>
<a href="#" type="button" class="submit-btn3">Change</a>
</td>
</tr>
</tbody>
</table>
<script>
function setColor(e){
const colors = ['#e47911', 'green'];
const wartoscNetto = e.target.offsetParent.parentNode.children[6].innerText;
const currentTr = e.target.offsetParent.parentNode;
if(wartoscNetto > 1000) return currentTr.style.backgroundColor=colors[0];
currentTr.style.backgroundColor=colors[1];
};
const btn = document.querySelectorAll('.submit-btn3');
btn.forEach(el => el.addEventListener('click', setColor));
</script>
我以为我有这个问题。
事实证明,当前版本的Copilot在很多情况下只有一个建议。
您可以通过将鼠标悬停在建议方面来查看Copilot是否有其他建议。对我来说,在键盘快捷键“不起作用”的情况下,根本没有其他建议。
解决问题的另一种方法是通过 [value] = arrayformname.controls
,然后使用 datakey =“ value.id”
或任何其他属性。
P-table应该做的是将 [value]
的内容与 datakey
。
为了解决所有行扩展的问题,只需添加 rowexpandMode =“ single”
完整示例
<p-table dataKey="value.id"
rowExpandMode="single"
[value]="fatturaDettagli.controls">
<ng-template pTemplate="header">
<tr>
<th style="width: 3rem"></th>
<th>Name</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-expanded="expanded" let-i="rowIndex">
<tr [formGroupName]="i">
<td>
<button type="button"
pButton
[pRowToggler]="rowData"
class="p-button-text">
</td>
<td>{{rowData.get('name').value}}</td>
</tr>
</ng-template>
</p-table>
在与@Sandeep Ranjan进行了对话之后:
这里的挑战是从存储为动态的JSON文档中提取字段,然后将它们包装到3个新的JSON文档中。
提取字段很简单,e,g。:
customDimensions.myfield
或
customDimensions["myfield"]
以后的字段名称具有空格和/或特殊字符的字段名称,例如:
customDimensions["my field"]
customDimensions["my-field!"]
包装字段可以使用3种不同的函数来完成彼此的同义词。
这些功能是 pack()&amp; bag_pack(
) :
let requests = datatable(customDimensions:dynamic) [dynamic({"x":1, "y":2, "z":3, "a":"hello", "b":"world", "k1":"v1", "k2":"v2", "k3":"v3", "k4":"v4"})];
requests
| project-rename cd = customDimensions // just to make things a little bit shorter
| extend json_1 = pack_dictionary("x",cd .x, "y", cd.y, "z", cd.z)
| extend json_2 = pack_dictionary("a", cd.a, "b", cd.b)
| extend json_3 = pack_dictionary("k1", cd.k1, "k2", cd.k2, "k3", cd.k3, "k4", cd.k4)
cd | json_1 | json_2 | json_3 |
---|---|---|---|
{“ x”:1,“ y”:2,“ z”:3,“ a”:“ hello”,“ b”:“ world”,“ k1”:“ v1”,“ k2 “:” v2“,“ k3”:“ v3”,“ k4”:“ v4”} | {“ x”:1,“ y”:2,“ z”:3} | {“ a”:“ hello”, “ b”:“ world”} | {“ k1”:“ v1”,“ k2”:“ v2”,“ k3”:“ v3”,“ k4”:“ v4”} |
您可以在字典中生成从索引到键的映射。然后,您可以使用a transpose操作和 argmin操作。
从那里,您可以使用列表理解将生成的索引转换为字典中出现的键。
key_indices = {idx: key for idx, key in enumerate(dictionary)}
indices = [min(range(len(lst)), key=lambda x: lst[x]) for lst in zip(*dictionary.values())]
[key_indices[index] for index in indices]
这输出:
[1, 1, 1]
如您的另一个问题所示(如何仅从中仅获取特定数据GraphQl查询), links
是一个数组,除非您循环循环或访问您无法做的特定位置:
post.data.links.blog.document.map((test)
我想您正在尝试做:
post.data.links[0].blog.document.map((test)
根据链接
结构,它似乎是1个项目的数组。
在返回JSX之前,尝试通过添加断点或 console.logs
来调试循环,以便您可以查看要通过的内容:
{
post.data.links.blog.document.map((test) => {
console.log(test);
return (
<GridPosts>
<GridPost>
<img src={Post2} alt="Post1" />
<FlexPost>
<PostTitle>TEST</PostTitle>
<PostParagraph>
A lot of different components that will help you create the
perfect look for your project
</PostParagraph>
<PostTag>Fiction</PostTag>
</FlexPost>
</GridPost>
</GridPosts>
);
});
}
对于触发
pull_request
而言,这是不正确的。这足以让此触发器与您的拉请请求相关联的分支 - 无需将其放入基本分支。pull_request_target
需要在基本分支中才能命名一个示例。 -That's not true for the trigger
pull_request
. It is enough for this trigger to be on the branch associated with your pull request -- no need to put it in the base branch.pull_request_target
, however, needs to be in the base branch to name an example. –GitHub Action PR工作流程开发常规