小编Ale*_*502的帖子

mvn dependency:go-offline - 你如何在命令行上或根本不设置参数

我想下载除了我自己的依赖项之外的所有东西,我还没有编译。我想我需要的是excludeGroupIds,但是如何在命令行上的https://maven.apache.org/plugins/maven-dependency-plugin/go-offline-mojo.html 中设置它或其他任何内容?

我试过这个

mvn dependency:go-offline -DexcludeGroupIds=com.example
Run Code Online (Sandbox Code Playgroud)

我也尝试将它们设置在pom.xmland 中settings.xml,但无法使它们产生任何效果。

maven maven-dependency-plugin

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

git rebase - 添加原始提交哈希以提交消息

有没有办法cherry-pick -x在rebase中做同样的事情(将原始提交的哈希添加到复制的提交的消息中)?

我现在可以通过更换以下内容来解决它

git checkout other-branch
git rebase master
git checkout master
git merge other-branch
Run Code Online (Sandbox Code Playgroud)

git checkout master
....
git cherry-pick -x other-branch^^^^
git cherry-pick -x other-branch^^^
git cherry-pick -x other-branch^^
git cherry-pick -x other-branch^
git cherry-pick -x other-branch
Run Code Online (Sandbox Code Playgroud)

git rebase

8
推荐指数
2
解决办法
447
查看次数

从服务工作者访问localStorage

我想定期从我的服务工作者调用API来发送存储在localStorage中的数据.当用户浏览我的网站时,将生成此数据并将其保存在localStorage中.考虑一下像在localStorage中保存统计信息并定期通过服务工作者发送它.我该怎么做?我知道我无法从服务工作者访问localStorage,并且必须使用postMessage API.任何帮助将受到高度赞赏.

javascript html5 web-worker service-worker

7
推荐指数
4
解决办法
9870
查看次数

使用 mocha 和 selenium-webdriver js 获得有意义的堆栈跟踪

当我在 JavaScript selenium 测试中找不到元素时,它并没有给我一个简单的方法来找出哪一行失败:

下面是一个例子:

// test.js

const webdriver = require('selenium-webdriver');
const Builder = webdriver.Builder;
const By = webdriver.By;

describe('web driver', function() {
  let driver;
  beforeEach(function() {
    return new Builder().forBrowser('chrome').build().then(function(_driver) {
      driver = _driver;
    });
  });

  it('should always be able to find the element', function() {
    return driver.findElement(By.name('test-element'));
  });

  afterEach(function() {
    return driver.quit();
  });
});
Run Code Online (Sandbox Code Playgroud)

当像这样运行时:

npm install selenium-webdriver@4.0.0-alpha.1
npm install mocha@6.0.2
nvm install 8.15.1
nvm use 8.15.1
node_modules/.bin/mocha test.js
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

     NoSuchElementError: no such element: Unable to locate element: {"method":"css …
Run Code Online (Sandbox Code Playgroud)

javascript selenium node.js async-await selenium-webdriver

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

babel 编译器,带有 Cucumber.js 版本 4

使用黄瓜@1,我可以运行需要像这样转换的测试

cucumberjs --compiler js:babel-core/register
Run Code Online (Sandbox Code Playgroud)

但这不适用于黄瓜@4

node_modules/.bin/cucumber-js --help
Run Code Online (Sandbox Code Playgroud)

不再列出--compiler选项

当我放入选项时它不会抱怨,但是当它到达第一个 jsx 尖括号时,它会抱怨。

javascript cucumber cucumberjs

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

使用sdkman切换系统版本

如果已安装,您可以像nvm这样回退到系统版本:

nvm use system
Run Code Online (Sandbox Code Playgroud)

sdkman 有类似的东西吗?要么关闭单个应用程序(类似sdk use ant system或完全关闭 sdkman

sdkman

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

如何使用 ansible 清除不在列表中的任何 ufw 条目

https://docs.ansible.com/ansible/latest/modules/ufw_module.html

我已将 Ansible 2 配置为允许使用 ufw 的一堆 IP 地址,其条目如下:

  - name: allow from this one computer
    ufw:
      rule: allow
      port: 22
      src: 192.168.5.5
Run Code Online (Sandbox Code Playgroud)

但是,我还想删除所有旧条目或错误到达的条目。

例如,如果旧版本有192.168.8.8,我想删除它。或者如果有人手动添加它。

有什么合理的方法可以做到这一点吗?我想如果服务器仅由ansible配置,并且当我从列表中删除IP地址时,我添加一个条目来删除它,我就不会遇到这个问题。

ansible ufw ansible-2.x

5
推荐指数
2
解决办法
3042
查看次数

javascript - 当我创建空项目数组时,我无法使用地图

我试过这个


> Array(3)
[ <3 empty items> ]
> // and this joins up all the nothings
> Array(3).join('-')
'--'
> // but...
> Array(3).map((x) => 'a')
[ <3 empty items> ]
> // map doesn't work with the array of empty items!
Run Code Online (Sandbox Code Playgroud)

我以为我会得到与此相同的结果

> [undefined, undefined, undefined].map((x) => 'a')
[ 'a', 'a', 'a' ]
Run Code Online (Sandbox Code Playgroud)

那是怎么回事?

javascript

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

Git 列出已更改的文件,但没有任何更改

这是极其基本的问题“为什么 Git 告诉我文件已更改但 diff 显示没有更改?”的无数个版本。类似的问题已发布在这里这里,但这些答案都没有帮助。

我的场景如下:

.gitattributes向现有的 Git 存储库添加了一个文件,其中包含多个已存在的提交。该文件的内容.gitattributes如下所示:

* text=auto

*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf

*.sh text eol=lf

*.csproj   text eol=crlf
*.filters  text eol=crlf
*.props    text eol=crlf
*.sqlproj  text eol=crlf
*.sln      text eol=crlf
*.vcxitems text eol=crlf
*.vcxproj  text eol=crlf

*.cs        text
*.config    text
*.jmx       text
*.json      text
*.sql       text
*.tt        text
*.ttinclude text
*.wxi       text
*.wxl       text
*.wxs       text
*.xaml      text
*.xml       text

*.bmp binary
*.gif binary …
Run Code Online (Sandbox Code Playgroud)

windows git

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

如何在球拍中查看扩展宏?

我得到了这个答案/sf/answers/4922329401/关于编写一个简单的宏来记录宏扩展时的时间,然后总是返回该时间。

#lang racket

(begin-for-syntax
  (define the-time (current-seconds)))

(define-syntax (macro-expansion-seconds stx)
  (datum->syntax stx the-time))

(macro-expansion-seconds)
(macro-expansion-seconds)
(macro-expansion-seconds)
Run Code Online (Sandbox Code Playgroud)

它工作得很好,但现在有没有一种简单的方法可以在(macro-expansion-seconds)不评估它的情况下查看它的扩展版本?(用于调试更复杂的)

racket lisp-macros

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