小编Mil*_*eri的帖子

带有进程替换的shell脚本中的语法错误

我有这个shell脚本,用于备份我的系统.有一条线:

tar -Pzcpf /backups/backup.tar.gz --directory=/ --exclude=proc --exclude=sys --exclude=dev/pts --exclude=backups --exclude=var/log / 2> >(grep -v 'socket ignored' >&2)
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,我一直试图通过tar过滤掉烦人的,无用的"套接字忽略"错误,使用此博客文章.

我在执行时从shell获得的是:

/ bin/sysback:第45行:意外令牌附近的语法错误>' /bin/sysback: line 45:tar -Pzcpf/backups/backup --directory =/--exclude = proc --exclude = sys --exclude = dev/pts --exclude = backups --exclude = var/log/2 >>(grep -v'cocket ignored'>&2)'

linux bash shell process-substitution

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

为JAR文件启动嵌入式jetty服务器

我想要做的是构建一个JAR包含我的项目的可执行文件.我已经将它的依赖项包含在它旁边,也包含在JAR文件中,所以我的目录列表看起来像这样:

〜/项目/ Java的/ web应用程序输入/输出:

网络app.jar

dependency1.jar

dependency2.jar

dependency3.jar

我知道并确信我的问题不是来自依赖关系,因为我的应用程序正常运行,直到我启动Jetty嵌入式的那一刻.

我用来启动Jetty的代码是这样的:

public class ServerExecutionGoal implements ExecutionGoal {    

    private final static Logger logger = Logger.getLogger(ServerExecutionGoal.class);    

    private WebAppContext getWebAppContext() throws IOException {    
        WebAppContext context = new WebAppContext();    
        System.out.println("context = " + context);    
        context.setResourceBase(new PathMatchingResourcePatternResolver().getResource("classpath:/webapp").getURL().toExternalForm());    
        context.setContextPath("/");    
        context.setLogger(new StdErrLog());    
        return context;    
    }    

    @Override    
    public void execute(Map<String, Object> stringObjectMap) throws ExecutionTargetFailureException {    
        logger.info("Instantiating target server ...");    
        final Server server = new Server(8089);    
        final ContextHandlerCollection handlerCollection = new ContextHandlerCollection();    
        try {    
            handlerCollection.setHandlers(new Handler[]{new …
Run Code Online (Sandbox Code Playgroud)

java web-applications jetty executable-jar embedded-jetty

8
推荐指数
1
解决办法
2956
查看次数

使用jQuery绑定AngularJS元素指令上的事件

我在AngularJS中有一个指令:

module = angular.module("demoApp", [], null);
module.directive('sample', function () {
    return {
        restrict: "E",
        transclude: true,
        replace: true,
        template: "<div ng-transclude></div>",
        controller: function ($scope, $element) {
            this.act = function (something) {
                //problematic line HERE
                $element.trigger("myEvent.sample", [something]);
            };
        }
    };
})
.directive('item', function () {
    return {
        restrict: "E",
        require: "^sample",
        transclude: true,
        replace: true,
        template: "<a ng-transclude style='display: inline-block; border: 1px solid crimson; margin: 2px; padding: 5px; color: crimson; text-decoration: none; background: #f5d0d0; cursor: pointer;'></a>",
        link: function (scope, element, attributes, …
Run Code Online (Sandbox Code Playgroud)

jquery events javascript-events angularjs angularjs-directive

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

如何覆盖javascript本机对象的内置方法

让我们说我们有窗口对象的警报方法.我想用漂亮的警报器来增强它.

此外,我想保存现有的警报方法,以便我们可以在应用程序结束后切换回来.

像这样的东西,但它在firefox控制台中抛出错误.

window.prototype.alert = function(){

}
Run Code Online (Sandbox Code Playgroud)

javascript overriding built-in prototype-programming

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

带有AuthzUnixGroup的git-http-backend无法正常工作

我试图在CentOS 6机器上的Apache 2.2上设置git存储库,并安装git。我尝试遵循许多不同的方向,但我很茫然。我目前的情况包括能够clone正常但完全无法推动。

我似乎无法使认证位正常工作,因为我通常可以在设置http.receivepack为的同时执行推送true

我已经安装AuthzUnixGroup好了mod_authz_external

我去/var/www/git创建了一个名为repo的仓库my-repo.git,并git init --bare在其中进行了内部。

然后,我将git.conf文件设置/etc/httpd/conf.d/如下:

<VirtualHost "*:80">
  SetEnv GIT_HTTP_EXPORT_ALL
  SetEnv GIT_PROJECT_ROOT /var/www/git
  SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
  ScriptAlias /git /usr/libexec/git-core/git-http-backend
  AddExternalAuth pwauth /usr/local/libexec/pwauth
  SetExternalAuthMethod pwauth pipe

  <Directory "/usr/libexec/git-core/">
    AllowOverride None
    Options +ExecCGI -Includes
    Order allow,deny
    Allow from all
  </Directory>

  <Location "/git">
    AuthzUnixGroup on
    AuthType Basic
    AuthName "Git repository"
    AuthBasicProvider external
    AuthExternal pwauth
    Require group git
  </Location>

</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

指向我的Web浏览器可以mysite/git …

apache git centos centos6

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