我使用以下命令在 Ubuntu 上安装了 clang-tidy:
sudo apt install clang-tidy
Run Code Online (Sandbox Code Playgroud)
我在一个简单的 C++ 17 文件上运行它,并收到警告和错误:
/home/erelsgl/Dropbox/ariel/CPLUSPLUS/intro/01-single-file/ptr.cpp:17:3: warning: 'auto' type specifier is a C++11 extension [clang-diagnostic-c++11-extensions]
auto i = make_unique<int>();
^
/home/erelsgl/Dropbox/ariel/CPLUSPLUS/intro/01-single-file/ptr.cpp:17:12: error: use of undeclared identifier 'make_unique' [clang-diagnostic-error]
auto i = make_unique<int>();
Run Code Online (Sandbox Code Playgroud)
我如何告诉 clang-tidy 根据 c++17 标准检查这个文件?
注意:要构建程序,我运行:
clang++-5.0 --std=c++17 ptr.cpp
Run Code Online (Sandbox Code Playgroud) 我们的代码库包括:*trunk,*branch A - 从trunk开始,*branch B - 从分支A开始,
在分支A上工作的程序员想要将其重新集成到主干中,并继续仅在主干上工作.
我们不想将分支B重新集成到分支A中.
是否有可能让分支B与主干相关,而不是分支A,这样两个程序员可以继续分别在主干和分支B上工作?
(我希望我的问题很明确)
我写了一个接口MyInterface,它将由不同的实现者实现.
我还编写了一个类MyInterfaceTest,其中包含所有实现者应该能够用来测试其实现的通用测试方法.
我只是不知道如何让它作为JUnit测试工作.
目前,我有这样的事情:
public class MyInterfaceTest {
private static MyInterface theImplementationToTest = null;
@BeforeClass public static void setUpBeforeClass() throws Exception {
// put your implementation here:
theImplementationToTest = new Implementation(...);
}
@AfterClass public static void tearDownAfterClass() throws Exception {
theImplementationToTest = null;
}
@Test public void test1() { /* uses theImplementationToTest */ }
@Test public void test2() { /* uses theImplementationToTest */ }
}
Run Code Online (Sandbox Code Playgroud)
我使用静态方法,setUpBeforeClass因为每个实现的初始化需要花费很多时间,所以我想为所有测试初始化一次.
有了这个版本的测试,实现者必须改变代码setUpBeforeClass并放置自己的实现.
我确信还有另一种写入方式MyInterfaceTest,因此实现者只需要继承它或发送一个参数,而不是更改代码.但是,我在JUnit中没有足够的经验来使它工作.你能告诉我怎么做吗?
向我的网站发送内容的人使用Word,因此我获得了大量Word文档以转换为HTML.我想只保留基本的格式 - 标题,列表和重点 - 没有图像.
当我使用Libre Office"另存为HTML"转换它们时,生成的文件非常庞大,例如,112K的doc文件变成450K HTML,大部分都是无用的FONT和SPAN标签(出于某种原因,每个标点符号都被包含在内在自己的范围内!).
我尝试了这个脚本:http://www.techrepublic.com/blog/opensource/how-to-convert-doc-and-odf-files-to-clean-and-lean-html/3708基于tidy和sed,它将大小减小到大约150K,但仍有许多无用的SPAN.
我试图复制并过去Kompozer - 一个HTML编辑器,然后保存为HTML; 但它将我所有的非拉丁语(希伯来语)字母转换为"ְ"等实体,将大小增加到750K!
我尝试了docvert:https://github.com/holloway/docvert/issues/6但发现它需要一个需要其他库等的python库,这似乎是一个无穷无尽的依赖路径......
有没有一种简单的方法从Office文档创建干净的HTML?
我试图演示一个"随时算法" - 一种可以随时停止并返回其当前结果的算法.演示算法只返回i的一些数学函数,其中i正在增加.它会查看它是否被中断,如果是,则返回当前值:
static int algorithm(int n) {
int bestSoFar = 0;
for (int i=0; i<n; ++i) {
if (Thread.interrupted())
break;
bestSoFar = (int)Math.pow(i, 0.3);
}
return bestSoFar;
}
Run Code Online (Sandbox Code Playgroud)
在主程序中,我使用它像这样:
Runnable task = () -> {
Instant start = Instant.now();
int bestSoFar = algorithm(1000000000);
double durationInMillis = Duration.between(start, Instant.now()).toMillis();
System.out.println("after "+durationInMillis+" ms, the result is "+bestSoFar);
};
Thread t = new Thread(task);
t.start();
Thread.sleep(1);
t.interrupt();
t = new Thread(task);
t.start();
Thread.sleep(10);
t.interrupt();
t = new Thread(task);
t.start();
Thread.sleep(100);
t.interrupt();
t …Run Code Online (Sandbox Code Playgroud) 我使用本指南在PyPi上安装了新软件包。
现在,我想更新软件包。由于我没有找到有关此操作的指南,因此我尝试自己做:将版本从“ 1.0.0.dev1”更新为“ 1.0.0.dev2”,然后重新安装。它没有用:我得到了:
Uploading tee_table-1.0.0.dev1-py3-none-any.whl
HTTPError: 400 Client Error: File already exists. See https://pypi.org/help/#file-name-reuse for url: https://upload.pypi.org/legacy/
Run Code Online (Sandbox Code Playgroud)
我也阅读了这个问题,但信息似乎已经过时(自2012年起)。
有没有简单的用户指南,描述了如何将软件包的新版本上传到PyPi?
我在 Ubuntu 18.04 服务器上查看进程列表,看到以下两个进程:
930 ? Ssl 0:00 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers
958 ? Ssl 0:00 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal
Run Code Online (Sandbox Code Playgroud)
我确定我没有启动它们。这些是什么?它们有害吗?我如何阻止它们再次出现?
我创建了一个LibreOffice Writer文档,并从网页中复制了一些文本.
现在每当我创建项目符号列表时,项目都有一个顶部和底部黑色边框.
我可以使用Format - Paragraph - Borders - none删除边框,但边框只是跳转到下一个或上一个项目.
如何在不将新文本写入新文档的情况下摆脱这种奇怪现象?
我有以下Node.js项目(这是我的问题的最小工作示例):
module1.js:
module.exports = function() {
return "this is module1!";
};
Run Code Online (Sandbox Code Playgroud)
module2.js:
var module1 = require('./module1');
module.exports = function() {
return module1()+" and this is module2!";
};
Run Code Online (Sandbox Code Playgroud)
server.js:
var module2 = require('./module2');
console.log(module2()); // prints: "this is module1! and this is module2!"
Run Code Online (Sandbox Code Playgroud)
现在我想创建一个也将使用module2.js 的client.html文件.这是我尝试过的(并且失败了):
天真的版本:
<script src='module2.js'></script>
<script>alert(module2());</script> // should alert: "this is module1! and this is module2!"
Run Code Online (Sandbox Code Playgroud)
这显然不起作用 - 它产生两个错误:
使用Node-Browserify:运行后:
browserify module2.js > module2.browserified.js
Run Code Online (Sandbox Code Playgroud)
我将client.html更改为:
<script src='require.js'></script>
<script> …Run Code Online (Sandbox Code Playgroud) 我是 tox 和 GitHub 操作的新手,我正在寻找一种使它们协同工作的简单方法。我写了这个简单的工作流程:
name: Python package
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v1
- name: Install tox
run: pip install tox
- name: Run tox
run: tox
Run Code Online (Sandbox Code Playgroud)
它只是安装 tox 然后运行它。但是当我运行此工作流时,tox 安装工作正常,但运行命令返回错误:
tox: command not found
Run Code Online (Sandbox Code Playgroud)
从 GitHub 操作运行 tox 的正确方法是什么?
branch ×1
browserify ×1
c++ ×1
c++17 ×1
clang-tidy ×1
github ×1
html ×1
java ×1
javascript ×1
junit ×1
jvm ×1
libreoffice ×1
ms-word ×1
node.js ×1
pypi ×1
python ×1
python-3.x ×1
require ×1
shutdown ×1
smooth ×1
svn ×1
testing ×1
tox ×1
ubuntu ×1
upgrade ×1