小编Jos*_*hua的帖子

Apache dbd内部错误:AH00629:无法连接到mysql

我正在尝试使用dbd和mysql作为Apache 2.4的身​​份验证.

当Apache启动时,我有这个错误:

[Tue May 12 13:07:18.789021 2015] [mpm_event:notice] [pid 10625:tid 140410697815936] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Tue May 12 13:07:18.789118 2015] [core:notice] [pid 10625:tid 140410697815936] AH00094: Command line: '/usr/sbin/apache2'
[Tue May 12 13:07:18.789469 2015] [dbd:error] [pid 10628:tid 140410697815936] (20014)Internal error: AH00629: Can't connect to mysql: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
[Tue May 12 13:07:18.789560 2015] [dbd:error] [pid 10628:tid 140410697815936] (20014)Internal error: AH00633: failed to initialise
[Tue May 12 13:07:18.790282 2015] [dbd:error] …
Run Code Online (Sandbox Code Playgroud)

mysql apache dbd basic-authentication

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

CipherInputStream只读取16个字节(AES/Java)

我正在使用CipherInputStream和CipherOutputStream来使用AES加密文件.

encrypt(...)似乎工作正常,但我的decrypt(...)函数只解密我的文件的前16个字节.

这是我的班级:

public class AESFiles {

    private byte[] getKeyBytes(final byte[] key) throws Exception {
        byte[] keyBytes = new byte[16];
        System.arraycopy(key, 0, keyBytes, 0, Math.min(key.length, keyBytes.length));
        return keyBytes;
    }

    public Cipher getCipherEncrypt(final byte[] key) throws Exception {
        byte[] keyBytes = getKeyBytes(key);
        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
        SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, "AES");
        IvParameterSpec ivParameterSpec = new IvParameterSpec(keyBytes);
        cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec);
        return cipher;
    }

    public Cipher getCipherDecrypt(byte[] key) throws Exception {
        byte[] keyBytes = getKeyBytes(key);
        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); …
Run Code Online (Sandbox Code Playgroud)

java encryption aes stream

9
推荐指数
1
解决办法
8072
查看次数

Angular 2 typescript调用javascript函数

是否有正确的方法从Angular 2(TypeScript)中的组件调用JavaScript函数?

这是我的组件:

import { ElementRef, AfterViewInit }       from '@angular/core';

export class AppComponent implements AfterViewInit {

    constructor(private _elementRef: ElementRef) {
    }

    ngAfterViewInit() {
        /**
         * Works but i have this error :
         * src/app.component.ts(68,9): error TS2304: Cannot find name 'MYTHEME'.
         * src/app.component.ts(69,9): error TS2304: Cannot find name 'MYTHEME'.
         */
        MYTHEME.documentOnLoad.init(); 
        MYTHEME.documentOnReady.init();

        /**
         * Works without error, but doesn't seem like a right way to do it
         */
        var s = document.createElement("script");
        s.text = "MYTHEME.documentOnLoad.init(); MYTHEME.documentOnReady.init();";
        this._elementRef.nativeElement.appendChild(s);
    }
}
Run Code Online (Sandbox Code Playgroud)

直接调用JavaScript函数会导致编译错误,但"已编译"的JavaScript文件(app.component.js)中的语法是正确的:

AppComponent.prototype.ngAfterViewInit …
Run Code Online (Sandbox Code Playgroud)

javascript typescript angular

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

Hibernate - createNativeQuery带有"非实体类"结果

我是所有这些Hibernate/JPA的新手,所以我会尽量清楚.

在Hibernate中有没有办法使用createNativeQuery在查询中选择单个/或多个字段而不使用Entity类作为返回对象?

我试图这样做而不使用任何与XML相关的东西.

Query query = getEntityManager().createNativeQuery("select name from contact where id_contact = :idContact", String.class);
query.setParameter("idContact", 9293L);
Object string = query.getSingleResult();
System.out.println(string);
Run Code Online (Sandbox Code Playgroud)

使用这个我有例外: Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.MappingException: Unknown entity: java.lang.String

谢谢

编辑:

我也尝试过:

Query query = getEntityManager().createNativeQuery("select name from contact where id_contact = :idContact");
query.setParameter("idContact", 9293L);
List list = query.getResultList();
if (!list.isEmpty()){ 
    Object string = list.get(0);
    System.out.println(string);
}
Run Code Online (Sandbox Code Playgroud)

具有相同的例外: Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Object;

编辑(2):我开始认为它是Hibernate中的一个错误,或者不可能做这样的事情......

java hibernate jpa

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

Jenkins 声明式管道与来自 SCM 的 Docker/Dockerfile 代理

Jenkins 使用Declarative Pipeline Syntax如何Dockerfile.ci从 SCM (Git)获取 Dockerfile(在本例中),因为agent块是在所有阶段之前执行的?

pipeline {
    agent {
        dockerfile {
            filename 'Dockerfile.ci'
        }
    }
    stage ('Checkout') {
        steps {
            git(
                url: 'https://www.github.com/...',
                credentialsId: 'CREDENTIALS',
                branch: "develop"
            )
        }
    }
    [...]
}
Run Code Online (Sandbox Code Playgroud)

在我看到的所有示例中,Dockerfile 似乎已经存在于工作区中。

jenkins docker dockerfile jenkins-pipeline

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