小编wil*_*ast的帖子

git-archive一个子目录 -

我正在使用git-archive来存档git仓库中的子目录,如下所示:

git archive -o ../subarchive.zip HEAD subdir/*
Run Code Online (Sandbox Code Playgroud)

但是,生成的存档会维护subdir /目录结构,即内容为:

subdir/
   whatever.js
   morestuff.js
Run Code Online (Sandbox Code Playgroud)

当我真的想在存档的根目录中找到whatever.js和morestuff.js时.

怎么办?谢谢.

git subdirectory git-archive

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

如何获取Eclipse安装目录的绝对路径?

我正在编写一个由插件组成的Eclipse产品.
在我的一个插件中,我需要获取安装Eclipse的目录的绝对路径.
(即/Applications/Eclipse在Mac或C:\Program Files\EclipseWin上).

无法找到此API.想法?

directory install eclipse-plugin

12
推荐指数
2
解决办法
2万
查看次数

Rails应用程序没有加载添加到/ etc/environment的新环境变量

我正在尝试添加一个环境变量以在我的Rails应用程序中使用.目前,我们的应用程序使用了几个环境变量/etc/environment.他们工作正常.所以我添加了一个新变量/etc/environment(并重新启动它的地狱).但是当我尝试访问新变量时,它的未定义.打印输出ENV.inspect显示所有原始变量,但不显示我新添加的变量.为什么哦为什么?

运行Apache 2/Passenger 4/Rails 4.最近从Passenger 2/Rails 3升级,如果它很重要.

编辑

结果我认为"工作正常"的那些也不起作用(它们在我的Rails应用程序中重新定义).因此,没有任何变量/etc/environment被加载到应用程序中.不知道为什么我认为该系统有效,但事实并非如此.

ruby-on-rails passenger environment-variables

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

创建证书的New-SelfSignedCertificate提供了拒绝访问

我正在尝试New-SelfSignedCertificate在PowerShell中使用Windows 10创建证书,但是该命令给了我权限错误。我正在使用管理员帐户。

命令:

New-SelfSignedCertificate -Type Custom -Subject "CN=Contoso Software, O=Contoso Corporation, C=US" -KeyUsage DigitalSignature -FriendlyName MyCert -CertStoreLocation "Cert:\LocalMachine\My"
Run Code Online (Sandbox Code Playgroud)

输出:

New-SelfSignedCertificate : CertEnroll::CX509Enrollment::_CreateRequest: Access denied. 0x80090010 (-2146893808 NTE_PERM)
At line:1 char:1
+ New-SelfSignedCertificate -Type Custom -Subject "CN=Contoso Software, ..."
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-SelfSignedCertificate], Exception
    + FullyQualifiedErrorId : System.Exception,Microsoft.CertificateServices.Commands.NewSelfSignedCertificateCommand
Run Code Online (Sandbox Code Playgroud)

windows powershell certificate

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

通过算法搜索 url 重写保留自定义 url 参数

我们正在使用 Algolia 的 vue instantsearch。

当用户登陆带有一些初始 url 参数的页面时,algolia instantsearch 会加载初始搜索,并更改 url 以包含搜索参数。然而,当 algolia 重写 url 时,初始 url 参数不会保留,我们希望它们保留。即e

  • 落在/stuff?myparam=value
  • algolia 设置初始搜索结果并将 url 更改为并删除/stuff?refinementList=...url 参数。myparam有没有办法将其保留在网址中?

javascript algolia instantsearch.js vue-instant-search

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

在属性名称中使用冒号搜索xpath表达式会引发异常(node.js elementtree module)

使用nodejs中的elementtree包,我试图验证xml文件(特别是android清单文件)中是否存在某个xml属性.

var manifestTxt = fs.readFileSync('AndroidManifest.xml', 'utf-8'),
    manifestDoc = new et.ElementTree(et.XML(manifestTxt)),
    expected = 'application/activity[@android:name="com.whatever.app"]';

test.ok(manifestDoc.find(expected));
Run Code Online (Sandbox Code Playgroud)

我收到以下异常:

node_modules/elementtree/lib/elementpath.js:210
      throw new SyntaxError(token, 'Invalid attribute predicate');
        ^
Error: Invalid attribute predicate
Run Code Online (Sandbox Code Playgroud)

它似乎不喜欢属性名称中的冒号,但没有它,搜索不匹配.我认为我正在处理命名空间错误 - 但找不到正确的方法.

编辑这里是我正在搜索的示例xml:

<?xml version='1.0' encoding='utf-8'?>
<manifest ... xmlns:android="http://schemas.android.com/apk/res/android">
    <application android:debuggable="true" android:icon="@drawable/icon" android:label="@string/app_name">&#xA; 
        <activity android:label="@string/app_name" android:name="com.whatever.app">&#xA;                
            <intent-filter>&#xA;</intent-filter>
        </activity> 
    </application>
    <uses-sdk android:minSdkVersion="5" />
</manifest>
Run Code Online (Sandbox Code Playgroud)

javascript xpath elementtree node.js

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

节点AWS S3 getObject在文件流完成之前触发httpDone

我在节点应用程序中使用AWS s3 getObject方法下载zip文件,然后使用child_process.exec调用unzip:

var file = fs.createWriteStream(file_path);
s3.getObject(params).
on('httpData', function(chunk) { 
    process.stdout.write("."); 
    file.write(chunk); 
}).
on('httpDone', function() { 
    file.end(); 
    console.log('Download Complete'); 
    self.emit('downloadComplete');
}).
send();
Run Code Online (Sandbox Code Playgroud)

并且在downloadComplete事件中,调用此代码,这会引发错误:

exec = require('child_process').exec;
exec('unzip -o -qq ' + src + ' -d ' + dest, function (error, stdout, stderr) { 
    callback(stderr);
});
Run Code Online (Sandbox Code Playgroud)

exec调用返回此错误:

End-of-central-directory signature not found.  Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive.  In the
latter case the central directory and zipfile comment will …
Run Code Online (Sandbox Code Playgroud)

unzip amazon-s3 node.js aws-sdk

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