如果 state 是 true 播放 youtube 视频,并且它是 false 我想删除 youtube 播放。我的代码如下。
{this.state.isPreViewVideo && <PlayYouTube video_id="ScSn235gQx0" />}
Run Code Online (Sandbox Code Playgroud)
沙箱网址:
https://codesandbox.io/s/xryoz10k6o
繁殖方式:
如果输入表单中包含 4 位字符,则 setState 为“isPreViewVideo: true”,如果小于 false
当 state 为 true 时它工作正常,但是当 state 为 false 时,我会遇到以下错误。
DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
Run Code Online (Sandbox Code Playgroud)
有没有办法避免或解决这个错误?
我想在 terraform 执行后显示 terraform 创建的 aws_instance 的 public_ip 。
但是,仅显示第一台服务器的全局 IP。
我的源代码如下。
resource "aws_instance" "main" {
count = "3"
...
}
output "ec2_global_ips" {
value = "${aws_instance.main.*.public_ip}"
}
Run Code Online (Sandbox Code Playgroud)
语法有问题吗?如果您需要知道如何在 terraform 中将数组值显示为输出,请告诉我。
start_urls = ['https://github.com/login']
def parse(self, response):
return scrapy.FormRequest.from_response(response,formdata={'login': 'xx',
'password': 'xx'},callback=self.after_login)
def after_login(self, response):
if "authentication failed" in response.body:
self.logger.info("fail xx %s", response.body)
Run Code Online (Sandbox Code Playgroud)
我参考文档尝试了上面的代码,但是出现了以下错误。
if "authentication failed" in response.body:
TypeError: a bytes-like object is required, not 'str'
Run Code Online (Sandbox Code Playgroud)
它看起来像response.body 中的二进制文件。有没有办法避免这个错误?
我很好奇,一般来说,如果登录失败,response.body中是否会显示“身份验证失败”?
感谢您阅读我的问题。
我正在尝试通过获取使用 terraform 制作的 ELB、RDS 的端点来创建要在应用程序中使用的环境变量。
目前我正在尝试使用 aws cli 获取端点,如下所示,但有更简单的方法吗?
aws rds describe-db-instances --db-instance-identifier xxxx | jq '.DBInstances[].Endpoint.Address'
aws elb describe-tags --load-balancer-name xxxx | jq '.TagDescriptions[].LoadBalancerName'
Run Code Online (Sandbox Code Playgroud)
比如如何获取在terraform上创建的AWS stack的endpoint
我已经通过supervisord启动了“节点启动”。
我的问题是在supervisord 上停止/重新启动将导致节点app.js 进程保留而不会被杀死
这种情况下supervisord如何才能成功重启npm start命令呢?
主管配置文件
[supervisord]
nodaemon=true
[program:node]
command=npm start
directory=/xx
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
user=root
autostart=true
autorestart=true
redirect_stderr=true
exitcodes=1
Run Code Online (Sandbox Code Playgroud)
包.json
{
"name": "xx",
"version": "1.0.0",
"main": "app.js",
"scripts": {
"start": "node app.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"xxx
},
"devDependencies": {
"nodemon": "^1.11.0"
},
"description": ""
}
Run Code Online (Sandbox Code Playgroud) 在terraform中创建rds和elastic缓存后,我想调整优先级,以便设置ec2。
这对 terraform 可行吗?
准确地说,我在 ec2 上运行 docker。我想将弹性缓存的端点,由 terraform 创建的 RDS 传递给具有环境变量的 docker。
感谢您阅读我的问题。
terraform ×3
amazon-ec2 ×1
javascript ×1
node.js ×1
python ×1
python-3.x ×1
reactjs ×1
scrapy ×1
string ×1
supervisord ×1