小编mc.*_*cki的帖子

无法推送到git存储库 - 权限被拒绝

我有以下问题:

$ git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)

我已经检查了这样做的连接:

$ ssh -vT git@github.com
Run Code Online (Sandbox Code Playgroud)

和输出看起来不错,我被正确认证.

在进一步检查时,我注意到:

$ ssh-add -l
The agent has no identities.
Run Code Online (Sandbox Code Playgroud)

我试过运行ssh-agent,但没有改变:

$ ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-A1mhFqvqncuO/agent.766; export SSH_AUTH_SOCK;
SSH_AGENT_PID=767; export SSH_AGENT_PID;
echo Agent pid 767;
$ ssh-add -l
Could not open a connection to your authentication agent.
Run Code Online (Sandbox Code Playgroud)

我正在使用Arch Linux.任何帮助将非常感谢!提前致谢!

Github诊断帮助在这里.

git ssh github ssh-keys ssh-agent

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

Spring Security SAML插件 - 没有托管服务提供程序配置异常

我正在尝试使用Spring Security SAML扩展将SAML SSO与Spring Security集成.之前,我成功地运行了一个概念验证:https://github.com/vdenotaris/spring-boot-security-saml-sample.不幸的是,在将配置移动到我的项目后,它无法正常工作.

在分析了日志之后,我发现我的应用程序(SP)正在从提供的URL正确下载IdP元数据.但是,在尝试通过在浏览器中尝试https:// localhost:8443/saml/metadata下载我的SP的元数据后,将引发以下异常:

javax.servlet.ServletException: Error initializing metadata
at org.springframework.security.saml.metadata.MetadataDisplayFilter.processMetadataDisplay(MetadataDisplayFilter.java:120)
at org.springframework.security.saml.metadata.MetadataDisplayFilter.doFilter(MetadataDisplayFilter.java:88)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1645)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:564)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1111)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:498)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1045)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:98)
at org.eclipse.jetty.server.Server.handle(Server.java:461)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:284)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:534)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.opensaml.saml2.metadata.provider.MetadataProviderException: No hosted service provider is configured and no …
Run Code Online (Sandbox Code Playgroud)

java spring spring-security spring-saml

17
推荐指数
1
解决办法
5073
查看次数

量角器无法在已部署的应用程序上检测到Angular 5

我正在尝试使用Protractor和Cucumber为我的Web应用程序创建一个包含E2E测试的存储库.我从这个存储库开始:https://github.com/spektrakel-blog/angular-protractor-cucumber

当我强迫Protractor将应用程序视为常规网页时,测试运行正常.测试运行器正在与应用程序交互并期待一些结果.问题是,我想让Protractor检测Angular,以便在检查'Then'断言之前等待区域稳定.

这是我的protractor.conf.js:

exports.config = {
  allScriptsTimeout: 30000,
  capabilities: {
    browserName: 'chrome',
    chromeOptions: {
      args: ['--no-sandbox']
    }
  },
  directConnect: true,
  baseUrl: 'http://<ci-server-address>/',

  specs: [
    './e2e/features/*.feature'
  ],

  framework: 'custom',
  frameworkPath: require.resolve('protractor-cucumber-framework'),

  cucumberOpts: {
    require: ['./e2e/steps/**/*.ts'],
    strict: true,
    format: [
      'json:reports/summary.json'
    ],
    dryRun: false,
    compiler: []
  },

  onPrepare() {
    browser.ignoreSynchronization = true;
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
  }
};
Run Code Online (Sandbox Code Playgroud)

简而言之 - 测试使用以下配置运行,但是当我删除时browser.ignoreSynchronization = true;,我收到以下错误:Timed out waiting for asynchronous Angular tasks to finish after 30 seconds. This may …

cucumber protractor e2e-testing angular angular-e2e

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

使用 WebCrypto API 使用从字符串生成的加密密钥加密/解密数据

在我的 Web 应用程序中,当用户注销我的应用程序并在再次登录后恢复它时,我试图将数据存储在本地存储中。此数据是私有的,因此在保存之前需要对其进行加密。由于该要求,该过程如下所示:

加密:

  1. 从后端请求唯一字符串(密钥)(当前用户名和日期时间是参数)。
  2. 使用 window.crypto.subtle.importKey() 从该字符串生成 AES-GCM 加密密钥
  3. 加密数据并将其放入本地存储(以及用于从后端获取密钥的初始化向量和日期时间)。

解密:

  1. 等到用户再次登录。
  2. 从后端请求唯一字符串(密钥)(当前用户名和日期时间是参数)。
  3. 使用 window.crypto.subtle.importKey() 从该字符串生成 AES-GCM 加密密钥
  4. 从本地存储获取数据并解密。

这是代码(打字稿):

interface Data {
  queue: string;
  initializationVector: string;
  date: string;
}

private getEncryptionKey(): void {
  const date: string = this.getDateParamForEncryptionKeyGeneration();
  const params = new HttpParams().set('date', date);
  this.encryptionKeyDate = DateSerializer.deserialize(date);
  this.http.get(this.ENCRYPTION_KEY_ENDPOINT, {params}).subscribe((response: {key: string}) => {
    const seed = response.key.slice(0, 32);
    window.crypto.subtle.importKey(
      'raw',
      new TextEncoder().encode(seed),
      'AES-GCM',
      true,
      ['encrypt', 'decrypt']
    ).then(
      (key: CryptoKey) => {
        this.encryptionKey = key;
        this.decrypt();
      }
    );
  }); …
Run Code Online (Sandbox Code Playgroud)

encryption cryptography typescript webcrypto-api

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

Java - Swing中的mouseMoved()事件处理

我想在JFrame中监听鼠标移动和点击.为此,我添加了一个像这样实现的MouseListener :( View类的完整代码位于https://gist.github.com/2837224,Board类位于https://gist.github.com/2837231)

class BattleshipsFrame extends JFrame {
  private final Board playerBoard, opponentBoard;
  private View view;

/** Main window constructor. */
BattleshipsFrame() {
  ...
  ...   
  ...
  //creating and displaying boards
  playerBoard = new Board();
  opponentBoard = new Board();
  PlayerBoardListener mouseListener = new PlayerBoardListener();
  this.addMouseListener(mouseListener);
  playerBoard.addMouseListener(mouseListener);
  opponentBoard.addMouseListener(new OpponentBoardListener());
  boards.add(playerBoard);
  boards.add(opponentBoard);
  ...
  ...
  ...
}

/** Listener responsible for handling mouse events on player board */
private class PlayerBoardListener extends MouseAdapter {
  @Override public void mousePressed(MouseEvent event) { …
Run Code Online (Sandbox Code Playgroud)

java swing event-handling mouseevent mouse-listeners

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

使用Spring和Angular进行Html5路由

我正在尝试使用Spring-boot和Angular 1.5实现HTML5路由,遵循本文.

在某些时候,我需要使用这样的控制器将所有角度路径重定向到基本路径:

@Controller
 public class UrlController {
  // Match everything without a suffix (so not a static resource)
  @RequestMapping(value = "/{path:[^\\.]*}"))
  public String redirect(HttpServletRequest request) {
    // Forward to home page so that route is preserved.
    return "forward:/";
  }
}
Run Code Online (Sandbox Code Playgroud)

正则表达式匹配大多数URL,如仪表板,搜索等:

 2016-08-05 16:39:58 DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping:306 - Looking up handler method for path /dashboard
 2016-08-05 16:39:58 DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping:313 - Returning handler method UrlController.redirect(javax.servlet.http.HttpServletRequest,java.lang.String)]
 2016-08-05 16:39:58 DEBUG o.s.b.f.s.DefaultListableBeanFactory:251 - Returning cached instance of singleton bean 'urlController'
 2016-08-05 16:39:58 DEBUG …
Run Code Online (Sandbox Code Playgroud)

java spring angularjs

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

如何在NPM上正确发布用TypeScript编写的Angular 1.5模块?

我正在尝试发布一个NPM模块,以在另一个项目中与Webpack一起使用。该模块使用TypeScript编写,并包含Angular 1.5模块。到目前为止,我已经提出了这样的建议:

import {ExampleDirective} from './example/ExampleDirective';
import {ExampleComponent} from './example/ExampleComponent';
import {IExampleInterface} from './example/IExampleInterface';
import {ExampleFilter} from './utils/ExampleFilter';
import {ExampleClass} from './example/ExampleClass';
import {ExampleService} from './example/ExampleService';

// export everything that you want to access directly in TS code outside the package
export {
    IExampleInterface, ExampleClass, ExampleService
}

// add to the module everything that should be available via Angular DI mechanism
angular.module('my.components', [])
    .directive('example1', ExampleDirective.factory())
    .component('example2', new ExampleComponent())
    .filter('example3', ExampleFilter.filter)
    .service('ExampleService', ExampleService);
Run Code Online (Sandbox Code Playgroud)

上面的文件称为index.ts,并导入/导出所有要使用的TS代码。然后,我有以下package.json:

{
  "name": "my-components",
  "version": "0.0.6",
  "main": "lib/index.ts", …
Run Code Online (Sandbox Code Playgroud)

intellij-idea npm angularjs typescript webpack

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

gtkmm程序看起来很糟糕

我和朋友们一起使用gtkmm在C++中编写了一个简单的照片查看器.一切都进展顺利,除了我们的应用程序看起来很差,与我们的Linux桌面上的任何其他GTK +应用程序完全不同.如果有人能就我们做错了什么给我们一些建议,我们将非常感激.

负责创建窗口的代码在这里(其余的在存储库中):https: //github.com/jjkrol/ZPR/blob/master/src/gui.cpp

屏幕截图:
屏幕截图http://i39.tinypic.com/ktatc.png

任何帮助都会感激不尽,提前谢谢!

c++ gtk gtk2 gtkmm gtk3

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

通过WebJars包含Bootstrap到SpringMVC项目的问题

我试图在SpringMVC项目中使用Bootstrap: 链接到GitHub repo

不幸的是,CSS文件不可见.浏览器在控制台中抛出错误,如下所示:

GET http://localhost:8080/finager/webjars/jquery/2.0.3/jquery.js 404 (Not Found)

我认为pom.xml具有正确的配置,因为我能够在Java资源 - >库 - > Maven依赖项下查看Eclipse中包含的WebJars(Bootstrap和JQuery).我也在servlet-context.xml中设置了这样的路径(最后一行):

<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />
<resources mapping="/webjars/**" location="/META-INF/resources/webjars/"/>
Run Code Online (Sandbox Code Playgroud)

我认为这一行是正确的,因为Tomcat不再说它不知道如何处理以'/ webjars /开头的请求.我找到的所有教程都只列出了这些步骤,我在互联网上找不到任何有用的信息.我花了一整天的时间,因为我是Spring开发的新手,所以任何帮助都会非常感激.提前致谢!

java eclipse spring-mvc maven twitter-bootstrap

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

ExtJS - 如何将组件配置选项传递给 XTemplates?

我定义了以下扩展 Ext.view.View 的类:

Ext.define('Aft.view.comments.CommentsList', {
  extend: 'Ext.view.View',
  xtype: 'comments-list',

  parameter: false,

  tpl: new Ext.XTemplate(
    '<tpl for=".">',
    '  <div class="comment">',
           // some code here
    '    <div class="fault">',
    '      <tpl if="this.parameter">',
             // some code also here         
    '      </tpl>',
    '    </div>',
    '  </div>',
    '</tpl>',
    {
      strict: true,
      // other methods and fields
    }),

  initComponent: function() {
    this.config = Ext.apply({}, this.config);
    this.tpl.config.parameter = this.config.parameter;
    this.callParent(arguments);
  }
});
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,我试图将一个布尔参数从组件外部传递到组件内部的 XTemplate。我正在尝试这样做,因为该组件在 3 个不同的地方使用。在其中之一中,我希望它看起来略有不同(只是没有一个 div)。我发现参数化的 XTemplate 将是一个很好的解决方案,但我不能强迫它工作。我正在创建这样的组件:

items: [
    {
        xtype: 'comments-list',
        parameter: false
    }
]
Run Code Online (Sandbox Code Playgroud)

无论我输入什么作为参数,我在配置中输入的所有内容似乎都在自定义类的其他实例之间共享。因此,要么每个 …

extjs extjs6

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

Python 的记录器能够轮换日志文件吗?

有没有办法使用 python 中附带的日志记录模块来轮换日志文件?就像 logrotate 中那样?

我使用了 logrotate 但它给出了一些奇怪的结果。

python logging

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