在 aliases.js 中,我试图从导入的 actionTypes 对象访问“SELECT_HOST”属性值。但是,根据 Webpack,这会导致“SyntaxError: Unexpected token, expected ,”错误。我无法确定actionTypes.SELECT_HOST访问对象属性值的标准点符号方式是什么语法错误。
actionTypes.js:
const actionTypes = {
SELECT_HOST : 'SELECT_HOST',
INVOKE_ASSESSMENT : 'INVOKE_ASSESSMENT',
RETRIEVE_ASSESSMENT : 'RETRIEVE_ASSESSMENT',
RETRIEVE_OPTIONS : 'RETRIEVE_OPTIONS',
RETRIEVE_RESULTS : 'RETRIEVE_RESULTS',
UPDATE_OPTIONS : 'UPDATE_OPTIONS'
};
export default actionTypes;
Run Code Online (Sandbox Code Playgroud)
别名.js:
import actionTypes from '../actions/actionTypes';
const selectHost = (host) => {
chrome.tabs.query({currentWindow: true, active: true}, (tabs) => {
host = new URL(tabs[0].url).hostname;
});
const action = {
type: actionTypes.SELECT_HOST,
host
};
return action;
};
export default {
actionTypes.SELECT_HOST: selectHost
};
Run Code Online (Sandbox Code Playgroud)
Webpack …
我正在尝试使用 terraform 来设置 S3 + Cloudfront 静态站点。最初,我按照https://alimac.io/static-websites-with-s3-and-hugo-part-1/中的步骤成功设置了该网站
但是,后来我将 terraform 状态后端从 更改为localNow s3,当我执行时,terraform apply出现以下错误:
Error: Error applying plan:
2 error(s) occurred:
* aws_cloudfront_distribution.primary_domain: 1 error(s) occurred:
* aws_cloudfront_distribution.primary_domain: CNAMEAlreadyExists: One or more of the CNAMEs you provided are already associated with a different resource.
status code: 409, request id: <removed>
* aws_cloudfront_distribution.secondary_domain: 1 error(s) occurred:
* aws_cloudfront_distribution.secondary_domain: CNAMEAlreadyExists: One or more of the CNAMEs you provided are already associated with a different resource.
status …Run Code Online (Sandbox Code Playgroud) 我试图根据基于任务的异步模式报告异步函数的进度.
using System;
using System.Threading.Tasks;
namespace TestConsoleApplication1
{
class Program
{
static void Main()
{
Blah();
Console.ReadLine();
}
static async void Blah()
{
var ProgressReporter = new Progress<int>(i => Console.WriteLine(i + "%"));
await Foo(ProgressReporter);
}
static Task Foo(IProgress<int> onProgressPercentChanged)
{
return Task.Run(() =>
{
for (int i = 0; i < 1000; i++)
{
if (i % 100 == 0)
{
onProgressPercentChanged.Report(i / 100);
}
}
});
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是,随着i不断更新,在打印之前,输出会混乱.示例输出:
1%
3%
0%
4%
5% …Run Code Online (Sandbox Code Playgroud) 我正在开发一个SDI MFC应用程序,其中有一些自定义按钮以自定义方式绘制或者图像加载在它们之上.当正在运行的应用程序连续重新调整大小约5到10分钟时,它会因错误"未找到所需资源"而崩溃.
我已经彻底检查了代码,所有的GetDC()呼叫都跟着ReleaseDC()电话.此外,每当我DC.SelectObject(&newBrush)打电话然后恢复旧笔时,我总是保存旧的GDI对象(例如,oldBrush)DC.SelectObject(&oldBrush).
什么其他可能导致此错误的任何提示?
编辑:我使用程序Deleaker来查找程序中的GDI泄漏并删除导致泄漏的那些GDI对象.
编辑:这是AfxThrowResourceException的调用堆栈:
mfc110ud.dll!AfxThrowResourceException() Line 1353 C++
mfc110ud.dll!CWindowDC::CWindowDC(CWnd * pWnd) Line 1022 C++
mfc110ud.dll!CMFCToolBarImages::PrepareDrawImage(tagAFXDrawState & ds, CSize sizeImageDest, int bFadeInactive) Line 1219 C++
mfc110ud.dll!CMFCToolBarImages::DrawEx(CDC * pDC, CRect rect, int iImageIndex, CMFCToolBarImages::ImageAlignHorz horzAlign, CMFCToolBarImages::ImageAlignVert vertAlign, CRect rectSrc, unsigned char alphaSrc) Line 1729 C++
mfc110ud.dll!CMFCControlRenderer::FillInterior(CDC * pDC, CRect rect, CMFCToolBarImages::ImageAlignHorz horz, CMFCToolBarImages::ImageAlignVert vert, unsigned int index, unsigned char alphaSrc) Line 470 C++
mfc110ud.dll!CMFCControlRenderer::FillInterior(CDC * pDC, CRect rect, …Run Code Online (Sandbox Code Playgroud) async-await ×1
asynchronous ×1
c# ×1
c++ ×1
devops ×1
gdi ×1
javascript ×1
mfc ×1
node.js ×1
terraform ×1
webpack ×1