考虑一个简单的表单,它将电子邮件作为输入。如果身份验证失败,则“提交”按钮将调用引导模式。如果成功,它将重定向到下一个视图。
当出现引导模式时,浏览器会不断加载页面,等待响应。
我在服务器端使用此代码:
app.post('/', (req, res) => {
Users.findOne({
email: req.body.email
})
.then(user => {
if (user) {
obj = req.body.email
res.redirect('/survey')
}
})
})
Run Code Online (Sandbox Code Playgroud)
我试图添加一条else语句,以防找不到用户:
...
else {
console.log('User not found')
return
}
Run Code Online (Sandbox Code Playgroud)
我不想重定向到同一页面,因为模式无法正常工作。
是否有res实现此目的的方法?
最近,我r-essentials使用conda命令安装:conda install -c r r-essentials如本网址所述:https://anaconda.org/r/r-essentials.但是,当我尝试运行新的R内核时,ii根据此错误失败:
...Anaconda3\R/bin/x64/Rterm.exe' is not recognized as an internal or external command, operable program or batch file.
Run Code Online (Sandbox Code Playgroud)
我想删除安装后创建的R文件夹但我找不到删除该文件夹的方法.
我试过了:
conda uninstall r-essentials
Run Code Online (Sandbox Code Playgroud)
然后:
conda remove R
Run Code Online (Sandbox Code Playgroud)
最后一个,根据reddit上的这个答案:https://www.reddit.com/r/rstats/comments/57zh19/help_removing_anaconda_r_and_using_system_r_with/
其中任何一个已删除R文件夹.
是否有一个特定的命令来删除它?
当我在 s3 存储桶中存储的 json 文件的对象 URL中遇到两种不同的行为时,我的问题就出现了。
考虑一个 json 文件:mydata.json
如果我使用 AWS 网站上的 s3 仪表板上传此文件,我可以在浏览器中查看数据://s3-us-west-2.amazonaws.com/bucket/folder/mydata.json。如果我在 s3 存储桶中创建特定配置,我还可以从不同的应用程序读取此数据。
另一方面,如果我使用boto3python 库并在同一个存储桶中上传相同的文件(在此过程中使文件公开),当我单击对象 URL时,它会下载该文件,但不会在浏览器中打开数据。
这是我使用的代码:
# upload json file
bucket.upload_file(path, jsonkey)
object_acl = s3.ObjectAcl('bucket_name', jsonkey)
bucket_response = object_acl.put(ACL='public-read')
Run Code Online (Sandbox Code Playgroud)
我探索了文件属性,例如元数据。当我通过仪表板上传文件时,分配的元数据是Content-Type: application/json,通过boto3是Content-Type: binary/octet-stream。我真的不知道元数据是否会影响对象 URL行为。
在这种情况下,如何正确配置要下载或读取的 json 格式文件?我的意思是,影响对象 URL行为的主要配置是什么?
除了元数据之外,我在属性或权限方面找不到这两种方法(dashboard 和 boto3)之间的显着差异Content-Type。然而,当我试图改变时Content-Type,行为却是一样的。
我可以提供任何其他信息来澄清这个问题,请随时询问。提前致谢。
我正在使用node.js创建一个项目.我正在使用yo-yo库来创建html模板.
我想从tweet用户profile_banner_url添加一个封面.
像这样:
const yo = require('yo-yo')
module.exports = function (tweet) {
return yo`
<div class='cover'>
<img src='${tweet.user.profile_banner_url}' />
</div>
`
}
Run Code Online (Sandbox Code Playgroud)
但是,有时推文不会返回任何profile_banner_url,这会在浏览器中出错.
我试图从public目录中添加不同的图像:
<img src='${tweet.user.profile_banner_url} || otherimg.jpg' />
Run Code Online (Sandbox Code Playgroud)
但它没有用.
or在模板字符串中使用条件的最佳方法是什么?