我正在尝试编写一个配置文件,它将是一个数组(列表)或字典(哈希,表)。用 JSON 术语来说,例如
[
{
"a":1,
"b":2
},
{
"a":10,
"b":20
}
]
Run Code Online (Sandbox Code Playgroud)
我本来希望
[[]]
a = 1
b = 2
[[]]
a = 10
b = 20
Run Code Online (Sandbox Code Playgroud)
是正确的,但它被我的 Go 解析器拒绝了
unexpected token "]]", was expecting a table array key
Run Code Online (Sandbox Code Playgroud)
这表明只允许顶级字典(哈希、表)。真的是这样吗?
我突然无法创建索引(既不明确也不能将某些东西索引到不存在的索引中).其他操作很好(索引,搜索).我得到的错误security.log是:
[2015-02-10 15:48:46,303][DEBUG][action.admin.indices.create] [eu4] [yoptest2] failed to create
org.elasticsearch.cluster.metadata.ProcessClusterEventTimeoutException: failed to process cluster event (create-index [yoptest2], cause [auto(index api)]) within 1m
at org.elasticsearch.cluster.service.InternalClusterService$2$1.run(InternalClusterService.java:263)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Run Code Online (Sandbox Code Playgroud)
这是一个由三台机器组成的集群(健康绿色),无论我遇到哪个节点,都会得到相同的超时.
可能是什么原因?
我正在使用scroll方法来批量获取大量事件。我不知道如何适当地停止滚动。
我现在正在做的(有效)是检查TransportError哪个信号指示滚动尝试失败:
scanResp= es.search(
index="nessus_all",
doc_type="marker",
body={"query": {"match_all": {}}},
search_type="scan",
scroll="10m"
)
scrollId= scanResp['_scroll_id']
while True:
try:
response = es.scroll(scroll_id=scrollId, scroll= "10m")
# process results
except Exception as e:
log.debug("ended scroll: {e}".format(e=e))
break
# we are done with the search
Run Code Online (Sandbox Code Playgroud)
这会在中产生一个错误/var/log/elasticsearch/security.log:
[2015-02-16 09:36:07,110][DEBUG][action.search.type ] [eu4] [2791] Failed to execute query phase
org.elasticsearch.transport.RemoteTransportException: [eu5][inet[/10.81.147.186:9300]][indices:data/read/search[phase/scan/scroll]]
Caused by: org.elasticsearch.search.SearchContextMissingException: No search context found for id [2791]
at org.elasticsearch.search.SearchService.findContext(SearchService.java:502)
at org.elasticsearch.search.SearchService.executeScan(SearchService.java:236)
at org.elasticsearch.search.action.SearchServiceTransportAction$SearchScanScrollTransportHandler.messageReceived(SearchServiceTransportAction.java:939)
at org.elasticsearch.search.action.SearchServiceTransportAction$SearchScanScrollTransportHandler.messageReceived(SearchServiceTransportAction.java:930)
at org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:275)
at …Run Code Online (Sandbox Code Playgroud) 我有两个应用程序通过服务帐户访问我的用户的日历.直到今天,一切都工作正常,突然之间的一个应用程序无法获得授权令牌.我读到这可能是由于同时使用相同的服务帐户(这是一年的情况,但没关系)所以我决定
我在Google Developers Console中创建了服务帐户 - > API Manager - > Credentials.
控制台现在看起来像这样:
Service account client 1是原始服务帐户,它适用于这两个应用程序,现在仅适用于其中一个.该ga...帐户是新创建的帐户.
为了获得ClientID,我去了(在同一页面上)"管理服务帐户",我得到了这个:
新创建的帐户不提供检查其ClientID的可能性.为什么?
ClientID也可在创建时下载的JSON文件中使用.我从那里解压缩并试图在我的GApps Security控制台中授权访问:
你可以看到它被拒绝了.
创建第二个帐户时我错过了哪些部分?
我正在尝试将部署密钥用于属于组织的存储库(我是管理员).
我创建了一个私钥/公钥对,公共被粘贴到"部署密钥"窗口,并被接受.然后我尝试git pull从远程存储库连接:
git add origin git@myserver.com:/organization/therepo.git
git pull
Run Code Online (Sandbox Code Playgroud)
我一直被要求输入用户的密码git.我试图用,而不是用户git,gogs,<my login>,<the name or the organization>-我被要求对每一次的密码.
我尝试了一个简单的方法ssh -v来检查向gogs提供了哪个密钥:它是正确的密钥(上面的私钥,对应于部署(公共)密钥).
我应该使用哪个用户进行连接?
我有一个应用程序包含在此div:
<div id="app" v-bind:style='{backgroundColor: backgroundColor}'>
... the app ...
</div>
Run Code Online (Sandbox Code Playgroud)
import Vue from 'vue/dist/vue.js'
import VueRouter from 'vue-router'
import ComponentOne from './component1.vue'
import ComponentTwo from './component2.vue'
Vue.use(VueRouter)
const routes = [{
path: '/foo',
component: ComponentOne
},
{
path: '/bar',
component: ComponentTwo
}
]
const router = new VueRouter({
routes // short for `routes: routes`
})
const app = new Vue({
router,
data: {
day: "Monday"
},
computed: {
backgroundColor: function () {
console.log(JSON.stringify(router.currentRoute)) …Run Code Online (Sandbox Code Playgroud) 我的家庭应用程序(正面和背面)有一个简单的工作流程,全部在一项工作中,在自托管运行器上运行:
apt install ...)spaspa到后面的sources中spa目录嵌入到二进制文件中)这些步骤是线性的原因是我需要前端构建的输出来进行后端构建。
这个设置有效。
name: build-n-deploy
on: push
jobs:
dash:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
with:
ref: master
- name: prepare build environment
run: |
apt update
apt install software-properties-common -y
add-apt-repository ppa:longsleep/golang-backports -y
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
apt update && apt dist-upgrade -y
apt install nodejs -y
apt install golang-go -y
npm install -g @quasar/cli
- name: build front
working-directory: …Run Code Online (Sandbox Code Playgroud) 我正在解析一个大的(12 GB)XML文件,该文件由大约135k或多或少类似的记录组成(这是一个nmap转储).我注意到解析速度不一致,解析类似记录的时间变化很大.
以下按比例缩小的代码输出解析每1%记录所需的时间:
from xml.etree.ElementTree import iterparse
import time
nrhosts = 0
previous = time.time()
context = iterparse("test.xml", events=("start", "end"))
context = iter(context)
event, root = context.next()
for event, elem in context:
if event == 'end' and elem.tag == "host":
root.clear() # clean up memory
nrhosts += 1
if nrhosts % 1349 == 0: # hardcoded to estimate the % as there are ~135k of records
now = time.time()
print nrhosts // 1349, now - previous
previous = now
Run Code Online (Sandbox Code Playgroud)
这给出了: …
这是可能的添加自定义标题的requests电话,但有没有办法让它持续的,即必须添加到每个呼叫,而无需每次都指定了头?
我想Element在 Vue 中使用以下方法获得外部getElementById():
new Vue({
el: "#vue",
data: {
helloElement: document.getElementById('hello')
}
})Run Code Online (Sandbox Code Playgroud)
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.2/vue.js"></script>
<div id="hello">
hello
</div>
<div id="vue">
{{helloElement}}
</div>Run Code Online (Sandbox Code Playgroud)
这给我带来了一个空的Element,但不是null- 这表明查询部分成功(发现了一些东西)。
这实际上是一个针对我面临的更普遍问题的 POC:能够从 Vue 组件中获取外部Element(例如,容器)(这给我带来了一个,文档说这是找不到元素时的响应)。divnull
是否可以从 Vue 对象或组件内部查询ElementDOM 中存在的外部对象?
python ×3
vue.js ×2
github ×1
gogs ×1
google-api ×1
google-apps ×1
javascript ×1
parsing ×1
performance ×1
toml ×1
vue-router ×1
xml ×1