我试图打开unsigned int类型的scoped-enum:
枚举定义为:
const enum struct EnumType : unsigned int { SOME = 1, MORE = 6, HERE = 8 };
Run Code Online (Sandbox Code Playgroud)
我收到一个const unsigned int引用,我试图根据枚举值检查该值.
void func(const unsigned int & num)
{
switch (num)
{
case EnumType::SOME:
....
break;
case EnumType::MORE:
....
break;
....
default:
....
}
}
Run Code Online (Sandbox Code Playgroud)
这会导致语法错误: Error: This constant expression has type "EnumType" instead of the required "unsigned int" type.
现在,static_cast在每个开关上使用a ,例如:
case static_cast<unsigned int>(EnumType::SOME):
....
break;
case static_cast<unsigned int>(EnumType::MORE):
....
break;
Run Code Online (Sandbox Code Playgroud)
修复了语法错误,虽然在每个case语句中进行转换似乎不是一个好方法.我是否真的需要在每个案例中施放,还是有更好的方法?
在初始页面加载时,选项卡显示,但所选选项卡的内容不显示。
如果我单击“链接”选项卡并返回“发布”选项卡,它就会显示出来。
<div class="container">
<div class="card text-center">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs" id="tabs">
<li class="nav-item">
<a class="active nav-link" href="#post" data-toggle="tab">Post</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#link" data-toggle="tab">Link</a>
</li>
</ul>
</div>
<div class="card-body">
<div class="tab-content">
<div class="tab-pane" id="post">post</div>
<div class="tab-pane" id="link">link</div>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
在页面加载时,它看起来像这样(带有tab-pane类的 div尚未显示):
我的控制台中没有错误,并且加载了 bootstrap JS 文件。周围有一些类似的问题,但解决方案对我不起作用。
我需要添加什么才能在页面加载时显示选项卡窗格?
在进行本地开发时,我需要通过 HTTPS 为 vue 应用程序提供服务。
该应用程序正在提供:npm run serve它运行:vue-cli-service serve
我试图创建一个vue.config.js文件并向其中添加以下内容:
module.exports = {
devServer: {
port: 8080,
https: true,
}
}
Run Code Online (Sandbox Code Playgroud)
这导致控制台错误在Chrome V75,如以下情况:GET https://192.168.0.71:8080/sockjs-node/info?t=1564339649757 net::ERR_CERT_AUTHORITY_INVALID我猜这是Chrome的说,设置时使用的证书https来true是不是从一个有效的CA(也许是某种形式的自签名的东西在后台要去?)
我怎样才能解决这个问题?通过“让我们加密”生成证书可能是要走的路吗?
另一方面,我还使用 生成了一个根 CA 私钥,openssl genrsa -des3 -out rootCA.key 2048并使用 生成了一个自签名证书openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem,但我不确定如何告诉vue-cli-service尝试使用这些。但是,如果自签名证书ERR_CERT_AUTHORITY_INVALID在 Chrome 中导致错误,那么追求这条路线就没有多大意义
我有一个 API 运行在api.example.com. 我在 AWS Route53 中设置了此域,并使用将其指向 DigitalOcean 服务器的 DNS A 记录。这很好用。
我想在 Vercel 上部署一个前端应用程序。初始部署有效,我可以访问已部署的站点:https://example.vercel.app/。到目前为止太棒了!
此时,我想向 Vercel 添加一个域,以便用户可以访问example.com而不是example.vercel.app. 我猜这是通过添加 CNAME 记录在幕后完成的。当我添加此域时,example.com工作正常,但api.example.com(以及该服务器上的端点)不再解析为在 DigitalOcean 上运行的 API - 现在收到 404,Vercel 表示未找到。:
404: NOT_FOUND
Code: DEPLOYMENT_NOT_FOUND
ID: ..... long vercel related ID here .......
Run Code Online (Sandbox Code Playgroud)
在 Vercel 上,显示的 DNS 记录为:
对我来说,这里没有任何东西会破坏api.example.comDigitalOcean 服务器 IP 地址的解析。
Vercel 中是否有一种方法可以确保example.com(并希望www.example.com)被添加为域,但api.example.com不被触及?几乎看起来像是在幕后添加了通配符域或类似的东西。如果这不起作用,我总是可以为服务器端购买另一个域。
编辑:一定是* CNAME -> cname.vercel-dns.com.记录导致了这个!
在 Eclipse 中,我总是使用Ctrl + shift + fIDE 中的自动格式化代码。
Dev-C++中是否有类似的功能,或者是否有一些可用于格式化我的 C/C++ 代码的插件?
当我尝试在 Chrome 中调试 Nuxt.js 应用程序(客户端代码,而不是服务器端)时,我发现断点没有在我期望的时候被命中。
在nuxt.config.js我有以下 webpack 配置:
extend (config, ctx) {
if (ctx.isDev) {
config.devtool = ctx.isClient ? 'source-map' : 'inline-source-map'
}
}
Run Code Online (Sandbox Code Playgroud)
在组件 ( login/index.vue) 中,我有以下方法:
methods: {
login() {
// in the chrome developer console I can see that this logs, but setting a breakpoint on the below line,
// it tends to not always stop/"break" at this point
console.log("at login/index.vue")
this.$store.dispatch('login',
this.credentials
).then(response => {
console.log(response)
this.$router.push({
name: 'index'
})
}).catch(e => { …Run Code Online (Sandbox Code Playgroud) 即使服务器响应包含正确的Set-Cookie标头,我的 Laravel 会话 cookie 也不会在浏览器中设置。Laravel 服务器运行在 localhost:8000,客户端应用程序是一个运行在 localhost:7000 的 NuxtJS SPA。
包含的响应头Set-Cookie如下:
HTTP/1.1 200 OK
Host: localhost:8000
Date: Sun, 06 Sep 2020 00:50:31 GMT
Connection: close
X-Powered-By: PHP/7.4.10
Cache-Control: no-cache, private
Date: Sun, 06 Sep 2020 00:50:31 GMT
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, PATCH, DELETE
Access-Control-Allow-Headers: Access-Control-Allow-Headers, Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Authorization, Access-Control-Request-Headers, Set-Cookie
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
Set-Cookie: dv_session=ifhSq8WFD2Upltr5v2bzNBgaA5xx3KiDVuMWuBge; expires=Sun, 06-Sep-2020 02:50:31 GMT; Max-Age=7200; path=/
Run Code Online (Sandbox Code Playgroud)
通过邮递员发出相同的请求,cookie被保存:
因此,浏览器似乎忽略了“Set-Cookie”标头。
我的 session.php 文件如下: …
在为站点设置"更改密码"功能时,我有一个二级密码输入(您需要再次输入密码才能更改密码).
我需要能够根据输入的密码检查用户的当前密码(使用Bcrypt进行哈希).
在我的控制器动作中,我有:
$currentPassword = $request->request->get('password');
$encoder = $this->container->get('security.password_encoder');
$encodedPassword = $encoder->encodePassword($user, $currentPassword);
if($encodedPassword == $user->getPassword()) { // these don't ever match.
// ...
}
Run Code Online (Sandbox Code Playgroud)
encodePassword(...)生成输入密码的摘要,但它与保存的密码不同(明文相同),所以我认为正在应用不同的盐,从而产生不匹配.
由于Bcrypt在密码摘要中包含了salt,因此我不会将其保存在任何地方.
如何检查输入的纯文本密码是否与Symfony 3中存储的Bcrypt摘要相匹配?
我没用FOSUserBundle.
我正在尝试在服务器端使用 Laravel 5.3 实现 TinyMCE 图像上传:
这是我用于 TinyMCE 的 JS,它目前在刀片模板中:
<script src="{{ URL::to("/tinymce/tinymce.min.js") }}"></script>
<script>
tinymce.init({
selector: 'textarea',
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons template paste textcolor colorpicker textpattern"
],
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media",
relative_urls: false,
image_title: true,
automatic_uploads: true, …Run Code Online (Sandbox Code Playgroud) 我正在使用 MapBox,并且希望向 AWS S3 存储桶中的地图添加一些图像。
我使用的 MapBox 函数是loadImage。loadImage 文档声明“外部域必须支持 CORS”。
我的 JS 代码类似于:
this.map.on('load', () => {
...
this.map.loadImage("https://my-test-bucket.s3-us-west-1.amazonaws.com/long-uuid-here.png", (error, image) => {
if (error) {
console.log(error)
throw error;
}
// The rest doesn't matter
...
Run Code Online (Sandbox Code Playgroud)
当我的地图在 Chrome 中加载时,出现以下错误:
Access to fetch at 'https://my-test-bucket.s3-us-west-1.amazonaws.com/long-uuid-here.png' from origin 'https://localhost:7000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the …Run Code Online (Sandbox Code Playgroud) php ×3
c++ ×2
javascript ×2
vue.js ×2
amazon-s3 ×1
astyle ×1
bcrypt ×1
bootstrap-4 ×1
c++11 ×1
cookies ×1
cors ×1
csrf ×1
debugging ×1
deployment ×1
dev-c++ ×1
enums ×1
html ×1
https ×1
ide ×1
laravel ×1
laravel-5 ×1
laravel-7 ×1
mapbox ×1
nuxt.js ×1
passwords ×1
self-signed ×1
symfony ×1
tabs ×1
tinymce ×1
tinymce-4 ×1
tls1.2 ×1
vercel ×1
visual-c++ ×1
webpack ×1
windows ×1