const query = new URL(location).searchParams
const amount = parseFloat(query.get('amount'))
console.log("amount", amount)
document.getElementById('amount').value = amountRun Code Online (Sandbox Code Playgroud)
<label>
Amount
<input id="amount" type="number" name="amount">
</label>Run Code Online (Sandbox Code Playgroud)
抱歉,在上面或 JS fiddle 上运行代码片段似乎不适用于 URL 参数。
如果输入更改,我希望 URL 也更新,并使用新值。我如何在 vanilla JS 中实现这一目标?
CGO_ENABLED=1 我相信是当前的默认值,这意味着它取决于 GLIBC,它可以在更新和发行版之间进行重大更改。
CGO_ENABLED=0 是创建静态独立二进制文件的解决方法,为什么这不是默认值?
假设我有一个 YAML 文件https://raw.githubusercontent.com/kaihendry/days/main/template.yml 以及附带的架构: https: //raw.githubusercontent.com/awslabs/goformation/master/schema/sam。架构.json
我应该使用什么工具来验证 template.yml 以确保它在 Linux 命令行中是正确的?
目前/usr/sbin/alsaDebian中的方式知道使用声卡的过程如下:
echo $( \
lsof +D /dev -F rt \
| awk '/^p/ {pid=$1} /^t/ {type=$1} /^r0x(74|e)..$/ && type == "tCHR" {print pid}' \
| cut -c 2- \
| uniq \
)
Run Code Online (Sandbox Code Playgroud)
这是相当丑陋和依赖lsof.我正在寻找没有的POSIX解决方案lsof,也许使用/ proc.
time for i in /proc/*/fd/*; do readlink $i | grep -q /dev/snd/pcm && echo $i | awk -F '/' '{print $3}'; done | uniq
Run Code Online (Sandbox Code Playgroud)
不幸的是,似乎需要两倍于lsof上面的基本片段.你能让它更快,以使其成为可行的替代品吗?
更新我重写了以上内容:
#!/bin/sh
for i in /proc/[0-9]*/fd/*
do
if readlink $i | …Run Code Online (Sandbox Code Playgroud) 我知道如何通过google-signin-client_id 3089273xx-xxxxxxxxxxxx.apps.googleusercontent.com&创建经过Google身份验证的应用<script src="https://apis.google.com/js/platform.js" async defer></script>,但问题是,我无法将登录限制为仅限我公司的G Suite实例.
我的应用程序是一个托管在S3上的"无服务器"JS包.登录的Google令牌与访问敏感资源的AWS角色相关联.
因此,检查电子邮件googleUser.getBasicProfile()或传递hd参数的典型解决方案没有任何安全意义,因为它们可以使用浏览器开发工具IIUC进行操作.
我可以使用其他一些Google API或我可以应用的策略吗?我想这个解决方案将以我公司域名的特殊google-signin-client_id的形式出现,该域名由G Suite托管.这就是它与AWS角色的关系:
我知道我可以在AWS"用户池"中设置重复的用户并使用Cognito,但我正在尝试为公司员工提供"单一事实来源"并减轻管理负担.
在测试从 API 调用的数据库过程时,当它按顺序运行时,它似乎在大约 3 秒内始终如一地运行。但是我们注意到,当多个请求同时传入时,这可能需要更长的时间,从而导致超时。我正在尝试将“一次多个请求”案例复制为go test.
我尝试了-parallel 10go test 标志,但时间在 ~28s 是相同的。
我的基准测试功能有问题吗?
func Benchmark_RealCreate(b *testing.B) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
name := randomdata.SillyName()
r := gofight.New()
u := []unit{unit{MefeUnitID: name, MefeCreatorUserID: "user", BzfeCreatorUserID: 55, ClassificationID: 2, UnitName: name, UnitDescriptionDetails: "Up on the hills and testing"}}
uJSON, _ := json.Marshal(u)
r.POST("/create").
SetBody(string(uJSON)).
Run(h.BasicEngine(), func(r gofight.HTTPResponse, rq gofight.HTTPRequest) {
assert.Contains(b, r.Body.String(), name)
assert.Equal(b, …Run Code Online (Sandbox Code Playgroud) 我能够生成面板 JSON 来配置 Grafana 仪表板,如下所示:
jsonnet -J ~/grafana/grafonnet-lib mydash.jsonnet > mydash.json
Run Code Online (Sandbox Code Playgroud)
不过,我喜欢在 Grafana 本身中操作和编辑生成的仪表板。
我绝对感到困惑和沮丧的是,一旦我通过调整 Grafana 的设置等方式在 Grafana 中进行了 UI 更改……如何将其返回到Jsonnet 中?现在对我来说这是一次超级尴尬的开发经历。我导出面板 JSON 并在单独的窗口中打开源 Jsonnet,并认真尝试移植我的更改。
当您在 JSON 中可能遇到以下情况时,这尤其令人痛苦:
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": true,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
Run Code Online (Sandbox Code Playgroud)
您需要手动转换为 Jsonnet/Graffonet-lib:
sparklineShow=true,
sparklineFull=true,
colorBackground=true,
Run Code Online (Sandbox Code Playgroud)
我是否缺少技巧或工作流程?
我的目标是在 X 射线服务中看到镜头 A -> B -> A,但事实并非如此:
我已经对我的处理程序进行了检测,xray.Handler并且我也像这样使用 xray 上下文获取 B 端点ctxhttp.Get(r.Context(), xray.Client(nil), endpoint),但轨迹似乎仍然没有对齐!
A ID Root=1-6117a4c9-05351c6d72b1ece16f9acd25;Parent=40ef9f0e18b68969;Sampled=1 B ID Root=1-6117a4ca-42a190ac2cf7d6dd4fe06d21b7dc50d21;
我将最小的可重现代码放在https://github.com/kaihendry/x-amzn-trace-id 上
请问我错过了什么?
继续/sf/answers/4400192751/,我只想操作范围输入元素并使用该值更新 URL。
// https://github.com/vuejs/vue-router/blob/dev/examples/route-props/Hello.vue
var Hello = Vue.component('Hello', {
template: `
<div>
<h2 class="hello">Hello {{agility}} {{ $attrs }}</h2>
<input min=0 max=100 v-model="agility" type="range">
</div>
`,
props: {
agility: {
type: Number,
default: 25
}
}
});
const router = new VueRouter({
// mode: 'history',
routes: [
{ path: '*', component: Hello, props: true },
{ path: '/:agility', component: Hello, props: true },
]
})
new Vue({
router,
template: `
<div id="app">
<router-view></router-view>
</div>
`
}).$mount('#app')Run Code Online (Sandbox Code Playgroud)
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script …Run Code Online (Sandbox Code Playgroud)go ×3
javascript ×2
shell ×2
alsa ×1
apache ×1
audio ×1
aws-xray ×1
benchmarking ×1
cgi ×1
firebase ×1
google-api ×1
google-login ×1
google-oauth ×1
grafana ×1
html ×1
http ×1
jsonnet ×1
linux ×1
node.js ×1
posix ×1
schema ×1
testing ×1
trace ×1
validation ×1
vue-router ×1
vue.js ×1
yaml ×1