小编cis*_*iso的帖子

如何在Notepad ++中启用jslint插件以识别es6功能,例如“ =>”

是否可以在Notepad ++的jslint插件中启用ES6功能?

我尝试将es6和ES6选项设置为true,但这似乎不起作用。

具体来说,我正在使用箭头函数“ =>”,并得到jslint错误,该错误表示期望标识符并看到了“>”。

这适用于在Windows 2012 R2环境中使用notepad ++作为编辑器在node.js v 4.2.1下运行的程序。

javascript jslint notepad++ node.js ecmascript-6

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

为什么AutoHotkey会回复"系统无法找到文件"错误?

我是AutoHotkey的新手,无法理解为什么这个脚本会给我错误:

 Failed to launch program or document
 Action: <C:\Windows\System32\msg.exe>
 Params: <* "Initiated.">
 Specifically: The system cannot find the file specified.
Run Code Online (Sandbox Code Playgroud)

这是我的test.ahk文件中的简单脚本:

Run, "C:\Windows\System32\msg.exe" * "Initiated."
Run Code Online (Sandbox Code Playgroud)

我已经验证了msg.exe文件位于c:\ Windows\System32文件夹中,我可以在命令提示符和单击msg.exe程序的情况下运行它而不使用脚本.我也可以为msg.exe创建一个快捷方式,它可以工作,但我无法弄清楚如何获取test.ahk脚本文件来查看它.

我尝试以管理员身份运行脚本(通过单击test.ahk文件)但得到相同的错误.

windows autohotkey

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

当使用 get-content 回显到屏幕时,如何使 powershell 能够解释 ansi 颜色代码?

我有一个日志文件,其中包含各种文本周围的 ansi 颜色代码。我使用 powershell 语言命令将其回显到控制台:

get-content logfile.log -wait
Run Code Online (Sandbox Code Playgroud)

这样我就可以看到最新的日志更改。但是,所有 ansi 颜色代码都显示为文本字符,例如:

 Esc[90mEsc[39m
Run Code Online (Sandbox Code Playgroud)

如何在 powershell 窗口中将它们解释为颜色代码?

还不太熟悉 powershell 语言,是否有 powershell 命令或编码选项来处理这个问题?我已经阅读了各种 powershell 文档,但没有在其中找到任何有关这些 ansi 代码的内容。

windows powershell batch-file ansi-escape

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

这个循环中++ i和i ++之间有区别吗?

array.prototype.reduce函数位于:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce

它有以下循环:

for (index = 0; length > index; ++index) {
    if (this.hasOwnProperty(index)) {
      if (isValueSet) {
         value = callback(value, this[index], index, this);
      } else {
        value = this[index];
        isValueSet = true;
      }
    }
}
Run Code Online (Sandbox Code Playgroud)

我不认为索引在这里是先增加还是后增加,因为它是在每次循环迭代之后完成的,但是想要确定.

可以将其更改为index + = 1,以便传递jslint吗?请不要讨论jslint警告的优点.

这种变化会有什么不同吗?

javascript loops jslint pre-increment post-increment

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

处理请求时如何获取node.js中的端口号?

如果我有两个node.js服务器在运行,我怎么能告诉哪个服务器调用了processRequest函数?

var http = require('http');
var https = require('https');
function processRequest(req, res) {
    res.writeHead(200);
    res.end("hello world, I'm on port: " + ???.port + "\n");
}
var server1 = http.createServer(processRequest).listen(80);
var server2 = https.createServer(processRequest).listen(443);
Run Code Online (Sandbox Code Playgroud)

最初我想要端口号,但找不到对象/变量给我.根据以下答案,确定加密与非加密更有意义,因为要知道请求中的哪些http服务器.

node.js

3
推荐指数
4
解决办法
7214
查看次数

如何测试窗口(按标题)是否已从命令提示符打开?

在批处理文件中,我打开一个具有如下特定名称的窗口:

@echo off    
start "my log" /D \logs\ /I powershell -nologo -noexit -command "$host.ui.RawUI.WindowTitle = 'My log'"; get-content logfile.log -wait
Run Code Online (Sandbox Code Playgroud)

所以窗口标题是"我的日志".

仅当窗口尚未打开时,如何运行此命令.是否有bat文件命令来测试这个?我宁愿不使用程序或powershell命令,只是一个简单的bat文件cmd如果可能的话.

像这样的东西:

@echo off    
if EXISTS window("My log") goto skip

start "my log" /D \logs\ /I powershell -nologo -noexit -command "$host.ui.RawUI.WindowTitle = 'My log'"; get-content logfile.log -wait

:skip
Run Code Online (Sandbox Code Playgroud)

windows cmd batch-file windows-7-x64

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

如何从.bat文件中转义PowerShell双引号

我正在尝试使用从Windows 7中的bat文件运行的PowerShell命令,用两个双引号替换文件(temp1.txt)中的所有双引号:

powershell -Command "(gc c:\temp\temp1.txt) -replace '\"', '\"\"' | Out-File -encoding UTF8 c:\temp\temp2.txt"
Run Code Online (Sandbox Code Playgroud)

我一直收到错误:

 'Out-File' is not recognized as an internal or external command.
Run Code Online (Sandbox Code Playgroud)

当我更改命令以用字母"b"替换字母"a"时,它可以正常工作:

powershell -Command "(gc c:\temp\temp1.txt) -replace 'a', 'b' | Out-File -encoding UTF8 c:\temp\temp2.txt"
Run Code Online (Sandbox Code Playgroud)

我需要转义双引号,因为整个powershell -Command都是双引号字符串.你怎么逃避双重报价?

powershell escaping batch-file

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

如何使用mongoimport将包含双引号的数据导入mongodb?

我正在使用mongoimport导入csv文件.csv文件包含第二行嵌入双引号的文本.

"id","text"
"1","This is text"
"2","\"This is quoted text\""
Run Code Online (Sandbox Code Playgroud)

这应该导入为第二行的两行,包括作为文本一部分的开头和结尾引号.然而mongoimport响应:

c:\mongoimport -d testdb -c testtb --headerline --type csv --drop --file c:/temp1.csv
connected to: localhost
dropping: testdb.testtb
Failed: read error on entry #2: line 3, column 6: extraneous " in field
   imported 0 documents    error "read error: bare " in non-quoted field imported 0 documents.
Run Code Online (Sandbox Code Playgroud)

如何在引用字段中导入包含双引号的csv数据?还有另一种逃脱方法吗?

我的环境基于Windows.

csv mongodb mongoimport

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

为什么 new RegExp() 字符串不需要转义正斜杠?

阅读本文档https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp

“使用构造函数时,正常的字符串转义规则(包含在字符串中时在特殊字符前加 \)是必要的。”

那么为什么 RegExp() 的这两种用法没有区别呢?

"a/b/c".match(new RegExp("\/", "g")) // (2) [ "/", "/" ]
"a/b/c".match(new RegExp("/", "g"))  // (2) [ "/", "/" ]
Run Code Online (Sandbox Code Playgroud)

该文件是否不正确或者我遗漏了什么?

可能的重复问题表明正斜杠必须作为文字转义。使用字符串,上面的示例表明,考虑到带有构造函数的字符串的用例,情况并非如此。这个问题具体是关于在构造函数中使用字符串的。

因此,根据下面的答案,差异似乎在于文字,“和 / 都需要转义,但是当使用字符串时,仅需要转义”。

javascript regex

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