小编Sil*_*ley的帖子

在输入字段中选择文件后浏览器冻结

我有一个包含输入文件字段 [ <input type="file" id="select-file" accept=".md"><label for="select-file">Select import file</label>]的表单。它为更改事件 [ $("#form").on("change", "#select-file", handler)]定义了一个 jQuery 处理程序,以便在我选择文件后立即触发。

它可以在 Linux 上使用 Firefox 在工作中完美运行,在家中使用 Firefox 和 Chrome在Windows上完美运行。

而在使用 Chrome 或 Firefox 的 Windows工作时,浏览器在选择文件后会冻结大约 8 秒。只有在此中断之后,我才能按下表单上的其他按钮,并且“更改”事件会触发。

放弃 Windows 和工作不啮合的假设,冻结似乎与工作中可用的不同网络磁盘有关。任何人都可以建议我必须检查的内容并希望有一种避免冻结的方法吗?谢谢!

小例子:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>File Select</title>
    <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
</head>
<body>
<div id="import-form">
    <input type="file" id="select-file" accept=".md">
    <label for="select-file">Select a file</label>
    <p id="selected-file">No file selected</p>
</div>
<script>
$("#import-form").on("change", "#select-file", function(e) {
    $("#selected-file").text(e.target.value.split('\\').pop());
});
</script>
</body> …
Run Code Online (Sandbox Code Playgroud)

javascript performance firefox jquery google-chrome

8
推荐指数
1
解决办法
2299
查看次数

升级后 eslint 说 NodeJS 未定义

我已经Eslint从 7.7.0升级到 7.10.0,@types/node从 14.6.0 升级到 14.11.2。应用程序tsconfig.json定义types: ["node"]和打字稿版本为 4.0.3。Eslint 被调用eslint --env node,es2020

在升级之前,Eslint 从未在我的代码中标记任何问题。现在 Eslint 开始抱怨NodeJS没有在以下代码片段中定义:

private handleServerErrors(error: NodeJS.ErrnoException): void {
    if(error.code === "EADDRINUSE") {
        . . .
Run Code Online (Sandbox Code Playgroud)

我沉默了 Eslint 错误,编译成功。所以似乎是 eslint 特有的问题,而不是代码。

同样的问题发生在 namespace 的另一个文件中JQuery,但我还没有调查。

有什么我想念的吗?需要添加一些导入吗?eslint/typescript/node 有什么变化?

谢谢你的帮助!马里奥

node.js typescript eslint

8
推荐指数
1
解决办法
893
查看次数

如何在JointJS中以交互方式创建链接

我想以交互方式添加指向基于JointJS的图表的链接.

我的想法是pointerdown使用从原始节点到此临时节点的链接创建一个小的临时节点,将其拖到另一个节点的顶​​部,然后pointerup创建删除临时链接和节点的真实链接.

不幸的是,我不知道如何说服指针移动临时元素而不是pointerdown发生事件的节点.任何的想法?谢谢!

var tmp_obj;
paper.on('cell:pointerdown', function(cellView, evt, x, y) {
    if(evt.button == 1) {
        // Freeze the selected node so it does not move
        paper.findViewByModel(cellView.model).options.interactive = false;

        // Create a small temporary node on top of the selected node
        tmp_obj = new joint.shapes.basic.Rect({
            position: { x: x, y: y },
            size: { width: 5, height: 5 }
        }

        // Create the link between the original node and the small temporary node

        // And …
Run Code Online (Sandbox Code Playgroud)

javascript jointjs

5
推荐指数
1
解决办法
5404
查看次数

如何将编译器选项传递给 R 源包安装

sp从源代码在 Linux 上安装包。要使用英特尔编译器,我需要传递-std=c99给编译器,否则=for(int j...= 会出错。但是install.packages("sp", configure.vars = data.frame(CFLAGS = "-std=c99"))忽略了我添加的论点。R 文档对此含糊不清。

r icc

5
推荐指数
0
解决办法
1593
查看次数

使用 Nodejs 10 HTTP2 并快速崩溃

在 Windows 10 64 位上安装了 Nodejs 10.4.0。我想用这个 Nodejs 版本提供spdy的闪烁的新来切换模块http2。这是服务器(评论说您发现以前的spdy解决方案有效):

"use strict";
const express = require("express");
const fs = require("fs");

/* Initialize application */
const app = express();
app.get("/api", function(req, res) {res.send("All OK\n");});

const options = {
    key: fs.readFileSync("./server.key"),
    cert: fs.readFileSync("./server.crt")
};

// require("spdy")
//  .createServer(options, app)
//  .listen(9999, (error) => {
//      if(error) {
//          console.error(error);
//          throw error;
//      }
//      else {
//          console.log(`\nServer started (HTTP/2)\n`);
//      }
//  });

require("http2")
    .createSecureServer(options, …
Run Code Online (Sandbox Code Playgroud)

https openssl node.js spdy

5
推荐指数
0
解决办法
1403
查看次数

boost :: locale :: to_lower抛出bad_cast异常

在Win 7 64位和VS2010上提升1.54 x64.编译为"Release x64"并运行以下代码:

#include <boost/locale/conversion.hpp>
std::wstring y = L"NoNseNSE";
std::wstring w = boost::locale::to_lower(y);
Run Code Online (Sandbox Code Playgroud)

抛出std::bad_cast异常.添加后没有任何变化(如其他地方所示):

std::locale mylocale("");
std::locale::global(mylocale);
Run Code Online (Sandbox Code Playgroud)

to_lower(y)改为:to_lower(y, mylocale)或在环境中使用std::string而不是std::wstring或设置LANG.

目标是转换为小写意大利语UTF-8字.我没有找到这样的问题,所以我认为这是我的机器特定问题或升级库问题.顺便说一下,我从sourceforge下载了预编译的boost库(boost_1_54_0-msvc-10.0-64.exe).任何的想法?谢谢!马里奥

c++ boost boost-locale

4
推荐指数
1
解决办法
1305
查看次数

如何停止 VSC 中的终端旋转图标

我正在运行一个 npm 脚本来监视更改并重新编译我的文件。

通过最新更新之一,当我运行此脚本时,VSC 在终端窗口中显示一个旋转图标,表明某些内容正在运行。总体来说不错,但如果任务像本例一样不断运行,就会非常分散注意力。

是否有任何选项可以删除或隐藏此状态消息?谢谢!

VSC 版本:1.57.1​​(系统设置)提交:507ce72a4466fbb27b715c3722558bb15afa9f48 日期:2021-06-17T13:28:07.755Z Electron:12.0.7 Chrome:89.0.4389.128 Node.js:14.16.0 V8: 8.9.255.25-电子。 0 操作系统:Windows_NT x64 10.0.19043

终端任务栏

visual-studio-code

4
推荐指数
1
解决办法
573
查看次数

如何在 VS TextMateRules 中将标记设置为粗体+斜体

在 Visual Studio Code 中,我编辑 Markdown 文件。

在编辑器中,标记的文本以粗体**bold**呈现,标记的文本以斜体呈现但标记的文本仅呈现为斜体*italic****bold and italic***

我尝试加入editor.tokenColorCustomizations.TextMateRules以下规则:

{
  "scope": ["markup.italic.markdown", "markup.bold.markdown"],
  "settings": {
     "fontStyle": "italic",
     "fontWeight": "bold"
  }
}
Run Code Online (Sandbox Code Playgroud)

但 VSC 抱怨fontWeight设置中不存在这种情况,并fontStyle接受其中之一bolditalic两者的组合,但不接受两者的组合。

任何想法?谢谢!马里奥

markdown textmate visual-studio-code

3
推荐指数
1
解决办法
1910
查看次数

Node.js express、路由器和压缩

在基于 express 的 Node.js 应用程序中,我以这种方式加载压缩中间件:

const express = require("express");
const compression = require("compression");
const app = express();
app.use(compression());
Run Code Online (Sandbox Code Playgroud)

如果我添加一个路由器来管理 API 请求,我应该在路由器中再次加载压缩还是它的响应已经被压缩?

const router = express.Router();
router.use(compression()); // Is this needed or not?

router.get(...); // and all other API methods
app.use("/api", router);

app.use("/", express.static("./pages"));
Run Code Online (Sandbox Code Playgroud)

谢谢澄清!

http-compression node.js express

2
推荐指数
1
解决办法
963
查看次数

Inkscape 忽略 &lt;use&gt;

在 Inkscape 中导入以下 SVG 文件仅显示文本但忽略<use>语句(或其引用的组)。这是一个错误还是一个功能?有什么要改变的吗?顺便说一句,该<g>组比示例文件中的组更复杂。该文件在 Chrome 中正确显示。(Windows 10,Inkscape 最新版本)

谢谢!马里奥

<svg width="400" height="200" x="0" y="0"
    xmlns="http://www.w3.org/2000/svg">
<defs>
  <g id="plus">
    <circle cx="40" cy="30" r="20" stroke="#FF0000" fill="none"></circle>
  </g>
</defs>
<svg x="100" y="50">
  <rect x="1" y="1" width="78" height="86" rx="10" ry="10" stroke="#0000FF" fill="none"></rect>
  <use href="#plus"></use>
  <text x="20" y="74" width="68" height="26">ABCD</text>
</svg>
</svg>
Run Code Online (Sandbox Code Playgroud)

svg inkscape

2
推荐指数
1
解决办法
219
查看次数

在 tsc --build 中如何克服 --incremental 和 --tsBuildInfoFile

我的打字稿应用程序的不同部分位于不同的子目录中。在顶层目录中,atsconfig.json引用了各种子 tsconfig。我通过这构建了应用程序,tsc --build效果非常好。所有子项目都已incremental: true定义,有些还定义了tsBuildInfoFile.

现在我想强制重建。对于每个子项目都很简单,tsc -p subproj --incremental false --tsBuildInfoFile null但是如何将这些选项传递给--build

当我尝试时我收到:

client/tsconfig.json:16:9 - error TS5069: Option 'tsBuildInfoFile' cannot be specified without specifying option 'incremental' or option 'composite'.

16         "incremental": true,
           ~~~~~~~~~~~~~

client/tsconfig.json:17:9 - error TS5069: Option 'tsBuildInfoFile' cannot be specified without specifying option 'incremental' or option 'composite'.

17         "tsBuildInfoFile": "./tsconfig.tsbuildinfo",
Run Code Online (Sandbox Code Playgroud)

谢谢!

typescript tsc

1
推荐指数
1
解决办法
5499
查看次数