问题列表 - 第36432页

我为什么要用ssl?

我正在运行一个约会网站,目前还没有使用SSL.

我注意到像facebook和twitter这样的主要网站没有使用https进行登录,只是使用普通的旧http,https-ing我的网站真的有什么好处,或者它只适用于cc交易吗?

提前致谢.

ssl https

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

布尔值,条件运算符和自动装箱

为什么这会抛出 NullPointerException

public static void main(String[] args) throws Exception {
    Boolean b = true ? returnsNull() : false; // NPE on this line.
    System.out.println(b);
}

public static Boolean returnsNull() {
    return null;
}
Run Code Online (Sandbox Code Playgroud)

虽然这不是

public static void main(String[] args) throws Exception {
    Boolean b = true ? null : false;
    System.out.println(b); // null
}
Run Code Online (Sandbox Code Playgroud)

解决办法是更换的方式false通过Boolean.FALSE,以避免null被拆箱到boolean,可呈现是不可能的.但这不是问题.问题是为什么?JLS中是否有任何引用证实了这种行为,尤其是第二种情况?

java autoboxing boolean nullpointerexception conditional-operator

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

在 Fortran 中存储“函数指针”?

在 Fortran 中,您可以将函数/子例程 A 作为参数传递给另一个函数/子例程 B,但是您能否存储 A 以供以后检索和使用?

例如,这在 C 中是允许的

int foo(float, char, char) { /*whatever*/};

int (*pointerToFunction)(float, char, char);
pointerToFunction = foo;
Run Code Online (Sandbox Code Playgroud)

在 Fortran 中,您可以将子程序作为参数传递

subroutine foo
! whatever
end subroutine foo

subroutine bar(func)
    call func
end subroutine bar

program x

    call bar(foo)

end program
Run Code Online (Sandbox Code Playgroud)

但是如何以与 C 类似的方式存储 foo 的地址?

fortran function-pointers

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

DAO和服务层(JPA/Hibernate + Spring)

我正在设计一个基于JPA/Hibernate,Spring和Wicket的新应用程序.DAO和服务层之间的区别对我来说并不清楚.根据维基百科,DAO是

一个对象,它为某种类型的数据库或持久性机制提供抽象接口,提供一些特定的操作而不暴露数据库的细节.

我想知道DAO是否可以包含对数据访问没有太多帮助的方法,但使用查询更容易执行?例如"获取在某些机场运营的所有航空公司的清单"?听起来我更多的是服务层方法,但我不确定在服务层中使用JPA EntityManager是否是良好实践的一个例子?

java architecture spring dao jpa

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

Python:如何区分继承的方法

新手Python问题.我有一个继承自几个类的类,一些特化类覆盖了基类中的一些方法.在某些情况下,我想调用非专业方法.这可能吗?如果是这样,语法是什么?

class Base(object):
    def Foo(self):
        print "Base.Foo"

    def Bar(self):
        self.Foo()  # Can I force this to call Base.Foo even if Foo has an override?


class Mixin(object):
    def Foo(self):
        print "Mixin.Foo"


class Composite(Mixin, Base):
    pass


x = Composite()
x.Foo()  # executes Mixin.Foo, perfect
x.Bar()  # indirectly executes Mixin.Foo, but I want Base.Foo
Run Code Online (Sandbox Code Playgroud)

python oop inheritance

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

在iphone 4操作系统中自动启动应用程序

我想构建一个将在特定日期自动启动的应用程序.有没有办法在Iphone 4.0操作系统中这样做.实际上我正在构建一种提醒,它会在生日或其他事件等场合发送短信.在此先感谢您的帮助.

iphone

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

如何在dataTable中引用dataTable父级?

考虑一个虚拟案例:

<h:form id="wrapperForm">
    <h:panelGroup id="rowsContainer">
        <h:dataTable id="rowsTable" value="#{bean.rows}" var="row" >
            <h:column>
                <h:commandButton value="Click me to update (#{component.parent.parent.parent.clientId})">
                    <f:ajax render=":#{component.parent.parent.parent.clientId}" />
                </h:commandButton>
            </h:column>
        </h:dataTable>
    </h:panelGroup>
</h:form>
Run Code Online (Sandbox Code Playgroud)

单击按钮,id=rowsContainer可以按原样成功更新.

但是,如果我在ui:repeat那里添加它,它就不再起作用了:

<h:form id="wrapperForm">
    <ui:repeat id="blocksRepeat" var="block" value="#{bean.blocks}">
        <h:panelGroup id="rowsWrapper">
            <h:dataTable id="rowsTable" value="#{block.rows}" var="row" >
                <h:column>
                    <h:commandButton value="Click me 2 update (#{component.parent.parent.parent.clientId})">
                        <f:ajax render=":#{component.parent.parent.parent.clientId}" />
                    </h:commandButton>
                </h:column>
            </h:dataTable>
        </h:panelGroup>
    </ui:repeat>
</h:form>
Run Code Online (Sandbox Code Playgroud)

相反,这得到:

<f:ajax> contains an unknown id ':wrapperForm:blocksRepeat:0:rowsWrapper' - cannot locate it in the context of the component j_idt363
Run Code Online (Sandbox Code Playgroud)

但是,该组件确实存在该ID,因此EL应该没问题.不知何故ui:repeat …

java jsf jsf-2

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

在C++中继承operator =的麻烦

我遇到了operator =的继承问题.为什么这段代码不起作用,解决它的最佳方法是什么?

#include <iostream>

class A
{
public:
    A & operator=(const A & a)
    {
        x = a.x;
        return *this;
    }

    bool operator==(const A & a)
    {
        return x == a.x;
    }

    virtual int get() = 0; // Abstract

protected:
    int x;
};

class B : public A
{
public:
    B(int x)
    {
        this->x = x;
    }

    int get()
    {
        return x;
    }
};

class C : public A
{
public:
    C(int x)
    {
        this->x = x;
    }

    int get() …
Run Code Online (Sandbox Code Playgroud)

c++ inheritance abstract-class operator-keyword

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

类型比较不返回预期结果

我使用以下代码比较类型,以便DataContractSerializer在必要时使用正确的类型重新初始化.

    private void InitializeSerializer(Type type)
    {
        if (this.serializer == null)
        {
            this.serializer = new DataContractSerializer(type);
            this.typeToSerialize = type;
        }
        else
        {
            if (this.typeToSerialize != null)
            {
                if (this.typeToSerialize.GetType() != type.GetType())
                {
                    this.serializer = new DataContractSerializer(type);
                    this.typeToSerialize = type;
                }
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

出于某种原因,当我比较两种类型时,结果始终为真,我从不输入最终的'if'语句并重新初始化我的序列化器.

我可以在比较中设置一个断点,并清楚地看到这两种类型是 List<Host>(this.typeToSerialize.GetType())和 Post(type.GetType())

Host和Post共享一个共同的祖先,但这不应该影响结果.

.net c# reflection comparison types

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

使用eclipse进行Weblogic远程调试

我的Weblogic安装在Red Hat OS机器上.

在startWebLogic.sh中我添加了这一行JAVA_OPTIONS =" - Xdebug -Xnoagent -Xrunjdwp:transport = dt_socket,address = 8888,server = y,suspend = n%JAVA_OPTIONS%"

当我尝试从Eclipse连接时,我收到"无法连接到远程VM.连接被拒绝.连接被拒绝:连接"消息.

你能告诉我哪里可能出错吗?

eclipse debugging weblogic using

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