小编IlG*_*ala的帖子

git无法克隆或推送?无法连接,连接被拒绝

之后git push -u origin master 我得到:

git://

当我尝试克隆其他repo时发生同样的错误.

端口8087似乎不忙.怎么可能出错?

编辑:当我从git://而不是https://进行克隆时,它可以正常工作.

git github

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

初始化延迟集合

我正在开发一个Struts2 + Spring + Hibernate webapp,我需要在检索一个对象或该对象的集合后初始化一个惰性集合.

用例

我有一个团队模型,其中一个关系急切地被称为员工(我认为很明显这是一个集合).反过来,员工模型有一个懒惰的关系注册表,我只需要一些特定的操作,所以我根本不需要急切地加载它.

现在.我打电话给我teamService(用Spring注入我的Struts2控制器),以便检索teamItem已经加载了他的收集员工的特定信息.现在是时候为每个员工加载其注册表关系了.

使用employeeService(也用Spring注入我的Struts2控制器)我调用initializeCollections()他的DAO方法,该方法应加载延迟集合调用

Hibernate.initialize(employee.getRegistry());
Run Code Online (Sandbox Code Playgroud)

当我执行此操作时,org.hibernate.LazyInitializationException: could not initialize proxy - no Session会抛出异常.

堆栈跟踪:

at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:167) ~[hibernate-core-3.6.10.Final.jar:3.6.10.Final]
at org.hibernate.Hibernate.initialize(Hibernate.java:414) ~[hibernate-core-3.6.10.Final.jar:3.6.10.Final]
at web.bkgd.simba.dao.registry.RegistryEmployeeDAO.initializeCollections(RegistryEmployeeDAO.java:438) ~[RegistryEmployeeDAO.class:?]
at web.bkgd.simba.service.abstractions.BaseService.initializeCollections(BaseService.java:142) ~[BaseService.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_79]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_79]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_79]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_79]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) ~[spring-tx-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:266) ~[spring-tx-4.1.0.RELEASE.jar:4.1.0.RELEASE] …
Run Code Online (Sandbox Code Playgroud)

java hibernate lazy-loading

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

如何使Java Hashtable.containsKey适用于Array?

很抱歉提出这个问题,但我是Java的新手.

Hashtable<byte[],byte[]> map = new Hashtable<byte[],byte[]>();
byte[] temp = {1, -1, 0};
map.put(temp, temp);
byte[] temp2 = {1, -1, 0};;
System.err.println(map.containsKey(temp2));
Run Code Online (Sandbox Code Playgroud)

不适用于.containsKey(因为打印结果为"False")

Hashtable<Integer,Integer> mapint = new Hashtable<Integer, Integer>();
int i = 5;
mapint.put(i, i);
int j = 5;
System.err.println(mapint.containsKey(j));
Run Code Online (Sandbox Code Playgroud)

工作(打印结果为"True")

我知道它与对象引用有关,但搜索后无法达到任何解决方案...

反正我是否可以使用Hashtable查找具有Array类型的键?我只是想测试一个特定的数组是否在Hashtable中作为键...

任何点击都会很棒.谢谢!!!

java hashtable

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

js-cookie: Cookies.get('cookieName') 返回未定义

我正在将此库用于我正在编码的 JQuery 插件……我将用户以这种方式创建的特定数据保存在 cookie 中:

// Update cookies checks if the cookie esists.
// If cookie exists => push data {myData:[obj1[, obj2, [...], objN]]}
// If cookie doesn't exists => create cookie with {myData:[obj1]}
function _updateCookie(name, cookie, data) {
    // Check if cookie exists
    var cookies = {myData:[]};

    // _getCookie(name) { return Cookies.get(name) }
    if (_getCookie(name) != undefined) {
        cookies = _getCookie(name);
    }

    cookies.reminders.push(cookie);

    Cookies.set(name, cookies, data);
}
Run Code Online (Sandbox Code Playgroud)

数据:

var data = {
    expires: 1,
    path: '/',
    domain: …
Run Code Online (Sandbox Code Playgroud)

javascript cookies jquery js-cookie

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

如何将多个图像添加到 html5 画布

我正在尝试将多个图像添加到Html5 画布,但每次我尝试删除最后一个图像并显示最新的图像时,它都会失败。这是我的代码:

var imgArray = ['abc.png','455.jpg'];
    for(i = 0; i < 2; i++){
        var canvas = document.getElementById('canvas');
        var context = canvas.getContext("2d");
        var imageObj = new Image();
        imageObj.src = imgArray[i];
        imageObj.onload = function() {
        context.drawImage(this,0,0);
    };
}
Run Code Online (Sandbox Code Playgroud)

如果我运行此代码,它会在画布上显示第二个图像并删除第一个图像。有没有办法保留两个图像?

html html5-canvas

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

ajax中的ajax无法正常工作

我正在使用页面上的ajax(jobs.php)将php输出加载到div中,此输出每隔几秒刷新一次,以显示来自sql的最新记录列表.

我试图使用ajax删除一个选定的记录,这在一个独立的页面上工作正常但是当我尝试从jobs.php页面执行它没有任何反应.

$(function () {
    $('.trash').click(function () {
        var del_id = $(this).attr('id');
        var $ele = $(this).parent().parent();

        $.ajax({
            type: 'POST',
            url: 'deleterecord.php',
            data: {del_id: del_id},
            success: function (data) {
                if (data == "YES") {
                    $ele.fadeOut().remove();
                } else {
                    alert("record could not be deleted")
                }
            }
        });
    });
});
Run Code Online (Sandbox Code Playgroud)

deleterecord.php

$delid = $_POST['del_id'];

$query5 = "DELETE from Records WHERE id = '$delid'";
$sql5 = mysqli_query($connection, $query5) or die(mysqli_connect_error());

if(isset($sql5)) {
    echo "YES";
} else {
    echo "NO";
}
Run Code Online (Sandbox Code Playgroud)

jobs.php

<script type="text/javascript">
    refreshdiv(); …
Run Code Online (Sandbox Code Playgroud)

javascript php ajax jquery

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

Laravel强制删除关系事件

我正在使用Laravel 5.2开发一个Laravel Web应用程序.我的问题很简单......我如何听取forceDelete事件以强制删除模型关系?

我一直在寻找网络和SO以及一些我发现的所有问题/答案都归结为删除方法,而且在API文档中我还没有找到很多...

在我的例子中,我有一个注册表模型和一个RegistryDetail模型

注册表

|id|name|surname|....
Run Code Online (Sandbox Code Playgroud)

RegistryDetail表

|id|id_registry|....
Run Code Online (Sandbox Code Playgroud)

我已经为这个boot功能创建了:

protected static function boot()
{
    parent::boot();

    static::deleted(function($registry) {
        // Delete registry_detail
        $registry->registryDetail->delete();
    });

    static::restored(function($registry) {
        // Restore registry_detail
        $registry->registrydetail()->withTrashed()->restore();
    });
}
Run Code Online (Sandbox Code Playgroud)

由于两个模型都只在调用delete()方法时才调用SoftDeletesstatic::deleted函数.如果我调用forceDelete()方法,则不会从数据库中删除相关模型.

如果您需要更多信息,请告诉我.

提前致谢

php soft-delete laravel laravel-5.2

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

RxJS 管道 Finalize 操作符没有被调用

import {
    Observable,
    BehaviorSubject
} from 'rxjs';
import {
    finalize,
    share
} from 'rxjs/operators'

export class someComponent() {

    public count$ = new BehaviorSubject < any > (0);

    public constructor() {
        this.shareResponse()
            .pipe(
                finalize(() => {
                    console.log('finalize called');
                }))
            .subscribe((event: any) => {
                // Do something
            });
    }
    public shareResponse(): Observable < any > {
        return this.count$.pipe(share());
    }
    public countChanged(event) {
        this.count$.next(event);
    }
}
Run Code Online (Sandbox Code Playgroud)

HTML:

    <some-tag(countChanged) = (countChanged($event)) > < /some-tag>
Run Code Online (Sandbox Code Playgroud)

rxjs angular6 angular7

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