小编Adr*_*sbe的帖子

从docker native osx中的docker容器访问所有usb

我刚刚为osx安装了docker native支持.我怎样才能将所有usbs共享到容器中?

我想做同样的事情是通过/dev/bus/usb:/dev/bus/usbdebian上使用docker 上的volume运行特权容器来完成的.我不想用--device论证.

谢谢.

beta macos native docker

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

如何使用常春藤和nexus发布第三方文物

我忙着用常春藤弄湿我的脚.我在我的本地PC上运行了一个现有的nexus存储库,以及一个现有的ant构建脚本.
两者都很好.

部分构建脚本有一些文件可以从网络共享中检索我们的第三方jar文件(log4j,xmlbeans,junit,pdf等等) - 最好是笨拙的.

我想使用ivy的依赖机制从nexus存储库中检索这些文件并在构建中使用它.每个3rdparty lib都有一个名称和一组任意文件(jar,dll,license.dat,xml等).

由于我们有大量的这些第三方库,每个lib都有多个文件 - 手动上传到nexus不是一个选项 - 我需要一些我可以用来获取一组文件,给它们一个lib名称,一个版本号和将结果上传到nexus.然后我需要能够从常春藤中检索这个.

我设法让上传部分工作,但撤销过程不起作用.使用我们的xmlbeans lib作为起点,我创建了以下ivy.xml文件

<ivy-module version="1.0">  
<info organisation="thirdparty_tools" module="xmlbeans" status="integration">  
<publications>  
  <artifact name="jsr173_api" type="jar" ext="jar"/>  
  <artifact name="saxon-dom" type="jar" ext="jar"/>  
  <artifact name="saxon-xpath" type="jar" ext="jar"/>  
  <artifact name="saxon" type="jar" ext="jar"/>  
  <artifact name="xbean" type="jar" ext="jar"/>  
  <artifact name="xbean_xpath" type="jar" ext="jar"/>  
  <artifact name="xmlpublic" type="jar" ext="jar"/>  
</publications>  
</ivy-module>  
Run Code Online (Sandbox Code Playgroud)

然后将一些蚂蚁脚本发布到nexus:

 <ivy:resolve/>  
    <ivy:publish <ivy:publish resolver="thirdparty" forcedeliver="true" update="true" revision="${version}" overwrite="true">  
      <artifacts pattern="[artifact].[ext]"/>  
    <ivy:publish/>  
Run Code Online (Sandbox Code Playgroud)

这一切都很好.它将所有jar文件发布到预期目录中的nexus.

当我尝试在我的构建中使用它时遇到麻烦.我为我的构建创建了以下ivy.xml文件:

<ivy-module version="1.0">  
    <info organisation="myCompany" module="GLB_Data"/>  
    <dependencies>  
        <dependency org="thirdparty_tools" name="xmlbeans" rev="2.2.0"/>  
    </dependencies>  
</ivy-module> 
Run Code Online (Sandbox Code Playgroud)

然后当我运行我的构建时 - 它找不到任何东西: …

ant nexus ivy

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

Maven不会接受Spock测试

我一直试图设置Maven来运行我的Spock(0.7)测试,但无济于事.我一直在试图使用groovy-eclipse-compiler作为gmaven其refered到在斯波克文件根据其公司的网站不再推荐.我的POM的相关部分:

<plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <compilerId>groovy-eclipse-compiler</compilerId>
                <verbose>true</verbose>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-eclipse-compiler</artifactId>
                    <version>2.8.0-01</version>
                </dependency>
                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-eclipse-batch</artifactId>
                    <version>2.1.8-01</version>
                </dependency>
            </dependencies>
        </plugin>
Run Code Online (Sandbox Code Playgroud)

当我跑步时,mvn test我得到:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
Run Code Online (Sandbox Code Playgroud)

任何想法为什么maven/surefire没有拿起我的测试?正如该网站的部分建议我确保存在空白文件src/test/java

groovy maven spock gmaven-plugin groovy-eclipse

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

在Hudson上最后成功构建

我想知道是否有人知道某种方式或插件以某种方式使用CLI从特定的Hudson作业获得最终构建版本的成功结果.

我可以看到这个结果保存在[DateTime]\build.xml文件中,所以我可以写一些东西来获取结果,但是想知道是否有人已经这样做了或者知道使用CLI获取这些信息的方法?

我试图找到有关文档的信息,但无法找到答案.如果您需要更多细节,请告诉我.

automation hudson hudson-plugins hudson-api

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

使用带颜色/格式化字符的echo时出现Zsh问题

我只是切换到zsh,现在调整别名,其中打印一些文本(彩色)和命令.

我一直在尝试使用$ fg数组var,但是有副作用,所有命令在执行之前都会打印出来.
如果我只是在终端中使用颜色代码测试回声,则会发生同样的情况:

echo $fg_bold[blue] "test"
]2;echo "test"  test     #the test is in the right color
Run Code Online (Sandbox Code Playgroud)

为什么命令打印之前要做它应该做的事情?(我确切地说,只要打印出任何可用的命令就不会发生这种情况)我是否要为zsh设置一个特定选项,使用带有特殊参数的echo来获取它?

alias zsh

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

Hapi JS 发送文件

我有下一个任务:

我的服务器中的一个请求想要获取包含统计信息的 csv 文件。我有 JSON 结构。使用模块https://github.com/wdavidw/node-csv,我从 json 创建一个 csv 结构。问题是:如何将其发送给具有正确 mime 类型(text/csv)的用户?

var arr = [["date,shop_id,product_id,count"]];
_.each(res, function(date) {
  _.each(date.unknown_products, function(count, product) {
    arr.push([date.date + ',' + id + ',' + product + ',' + count ]);
  });
});

csv()
  .from.array(arr)
  .to(function (data) {
    console.info(data); // => correct csv 
                                //  "date,shop_id,product_id,count"     
                                //  "2013-10-01,1,123,312"
    response += data;
  })
  .on('end', function (count) {
    console.log('Number of lines: ' + count); // => Number of lines: 33878

    //request.reply(new Hapi.response.Obj(response, 'text/csv'));
    request.reply(response); …
Run Code Online (Sandbox Code Playgroud)

javascript csv node.js mime-types hapi.js

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

如何在我的python程序中计算canny图像的非零像素数

我试图找到canny图像的非零像素数,你能帮忙吗?

这是我的代码:

import cv
def doCanny(input, lowThresh, highThresh, aperture):
    if input.nChannels != 1:
            return(0)
    out = cv.CreateImage((input.width, input.height), input.depth, 1)
    cv.Canny(input, out, lowThresh, highThresh, aperture)
    return out
def doPyrDown(input):
    assert(input.width !=0 and input.height !=0)
    out = cv.CreateImage((input.width/2, input.height/2), input.depth, input.nChannels)
    cv.PyrDown(input, out)
    return out

img = cv.LoadImage('mypic.jpg')
img2 = cv.CreateImage((img.width, img.height), img.depth, 1)
cv.CvtColor(img, img2, cv.CV_BGR2GRAY)
cv.NamedWindow("Example GRAY", cv.CV_WINDOW_AUTOSIZE)
cv.ShowImage("Example GRAY", img2)
img3 = doCanny(img2, 10, 100, 3)
img2 = doPyrDown(img3)
cv.ShowImage("Example 2", img2)
cv.WaitKey(0)
Run Code Online (Sandbox Code Playgroud)

python opencv

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

hapi和node.js创建REST API服务器

我希望构建一个包含大量数据更新和读取以及用户身份验证的Web服务.

哪一个是hapi,restify或表达Rest API 的更好选择? 请随意提出我尚未偶然发现的任何其他框架.

经过大量的搜索,我能找到的所有教程都使用了hapi framework pre v2.0.您能否建议我使用hapi和node.js构建Web API服务器的一些很好的教程?

我正在使用MongoDB来获取数据.

api rest node.js restify hapijs

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

使用 bunyan 记录请求

我用 node.js 和 express 构建了一个应用程序。我已经开始使用,bunyan但我很难理解热记录请求。

假设我的路由器调用这样的函数:

function(request, someOtherStuff, done){\\do something}
Run Code Online (Sandbox Code Playgroud)

whererequest是从 POST 请求生成的,并且在request.body.

我想执行以下操作:当函数内部发生错误时,我想记录错误以及req.body来自用户的请求(包括)。就像是:

if(err) {
  bunyan.error(err,request);
  done(err);
}
Run Code Online (Sandbox Code Playgroud)

我知道我可以serializers: {req: reqSerializer}在 bunyan 配置中使用,但是我找不到任何实际记录请求的示例。

任何建议都受到高度赞赏

error-handling node.js express bunyan

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

DynamoDB - 从 Map 中删除键值对

{
  "ExHashKey" : "id_asdfqe123"
  "Data" : { "key1" : "val1", 
             "key2" : "val2" 
     }
 }
Run Code Online (Sandbox Code Playgroud)

我正在尝试通过键从“数据”映射中删除元素。除了检索整个项目,进行更改,然后再次将其写入数据库之外,还有其他方法可以做到这一点吗?

我已经对 updateExpressions API 进行了大量研究,但没有找到任何有效的方法。

java amazon-dynamodb

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