小编Igo*_*gor的帖子

Javascript 警报消息包含 URL

我正在使用以下 JavaScript 函数:

<!-- Notifying message at the beginning of openning the website -->
    <script language="javascript" type="text/javascript">
        alert('Sorry!');
    </script>
    <!--End -->
Run Code Online (Sandbox Code Playgroud)

我想在警报消息中的“(抱歉!)”之后添加 URL,但我不知道如何将 URL 附加到 javascript 内的消息本身。

javascript

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

这里的协方差是否安全?

class Food{}

class Meat extends Food{}

class Animal{
    void feed(Food f){}
}

class Lion extends Animal{
    void feed(Meat m){}
}


void foo(Animal a){
   Food f = new Food();
   a.feed(f);
}
Run Code Online (Sandbox Code Playgroud)

如果我们发送到foo(new Lion())会怎么样?我知道它会出错,但我需要解释

java oop inheritance covariance

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

对垃圾收集感到困惑

在下面的代码中,执行第7行后有多少对象符合垃圾回收的条件?在我看来,1个z对象是合格的.是对的吗?

public class Tester 
{ 
  public static void main(String[] args) 
  {

    Integer x = new Integer(3000);   
    Integer y = new Integer(4000);   
    Integer z = new Integer(5000);

    Object a = x;   
    x = y;  
    y = z;
    z = null; //line 7 
   }
}
Run Code Online (Sandbox Code Playgroud)

非常感谢你.

java

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

MySql中的查询问题

String sql = "SELECT siteapplications.Application, Count(visits.VisitId) AS CountOfVisitId 
FROM visits, siteapplications 
WHERE visits.SiteApplicationId=siteapplications.ApplicationID 
and Month(visits.VisitTime)=" + month + " 
and Year(visits.VisitTime)=" + year + 
"GROUP BY siteapplications.Application 
ORDER BY CountOfVisitId DESC;";
rs = st.executeQuery(sql); 
Run Code Online (Sandbox Code Playgroud)

当我运行它时,我在java中遇到此错误:

您的SQL语法有错误; 检查与MySQL服务器版本对应的手册,以便在第1行的'BY Application ORDER BY CountOfVisitId DESC'附近使用正确的语法

我没有看到错误......

谁能帮忙......

thx all

java mysql

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

垃圾收集模拟OCPJP考试

i3 = null;在下面显示的类中执行时,有四个对象符合垃圾回收的条件.我添加了评论来解释我是如何得到这个答案的.我的推理是否正确?

public class Icelandic extends Horse{
    public void makeNoise(){
        System.out.println("vinny");
    }

    public static void main(String args[]){
        /**
         * 2 objects created
         */
        Icelandic i1 = new Icelandic();

        /**
         * 2 objects created
         */
        Icelandic i2 = new Icelandic();

        /**
         * 2 objects created
         */
        Icelandic i3 = new Icelandic();

        /**
         * i3 is now pointing at i1, original Icelandic() referred to by i3 now
             * has no reference -  2 objects now have no reference
         */
        i3 …
Run Code Online (Sandbox Code Playgroud)

java ocpjp

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

使用executeUpdate()删除 - grails

我现在遇到问题,我有2个域类,即医生病人,他们有1:m的关系.这是我的班级医生的代码

class Doctor {

String name
String specialization

def doctorService

static hasMany = [patients: Patient]
static belongsTo = [hospital: Hospital]


static constraints = {

    name(blank:false)
    specialization(blank:false)
    patients(nullable:true)
    hospital(nullable:false)
}

String toString(){

    "Doctor ${name} "

}

}
Run Code Online (Sandbox Code Playgroud)

- >这是我的类患者代码:

class Patient {

String name
String ailment
int age
Date dateAdmit, dateDischarge

static belongsTo = [doctor: Doctor, hospital: Hospital]

static constraints = {

    name(blank:false, maxSize:100)
    ailment(blank:false)
    age(size:1..200)
    dateAdmit(nullable:true)
    dateDischarge(nullable:true)
    hospital(nullable:false)
    doctor(nullable:false, validator:{val, obj -> …
Run Code Online (Sandbox Code Playgroud)

grails hql

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

Windows 7 Grails安装

我第一次使用Groovy和Grails并且无法让本地Windows 7环境接受到bin的路径的正确位置.至少我想在关注www.grails.org\Installation之后.

以下是提示反馈显示的内容:

C:\Groovy Grails\grails-1.3.7>gradlew

ERROR: JAVA_HOME might be set to an invalid directory: C:\Program Files\Java\jdk
1.7.0_03\bin;

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation if there are problems.
Run Code Online (Sandbox Code Playgroud)

该系统找不到指定的路径.

有什么建议去grails吗?

java grails

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

Postgres createuser想要​​一个密码(不是我的系统密码)

我使用自制软件在OS X Lion上安装了最新版本的postgres.路径是正确的:

$ which postgres
/usr/local/bin/postgres
$ which psql
/usr/local/bin/psql
Run Code Online (Sandbox Code Playgroud)

和酿医生很高兴.但是,当我尝试创建用户时,会发生以下情况:

$ createuser myuser
Password:
createuser: could not connect to database postgres: FATAL:  password authentication failed for user <$USER>
Run Code Online (Sandbox Code Playgroud)

密码绝对不是我的常用用户密码,我不知道如何找出它应该是什么.我可能在一段时间之前使用自制软件安装了不同版本的postgres,同时安装了许多其他东西,但我不记得了.我注意到了一个不同版本的'postgresql',它与新版本的'postgres'一起安装,我删除了它.

不知道这是否是一个线索,但当我这样做时:

$ sudo su - postgres
Run Code Online (Sandbox Code Playgroud)

psql(但不是postgres)的路径不再正确:

postgres$ which postgres
/usr/local/bin/postgres
postgres$ which psql
/usr/bin/psql
Run Code Online (Sandbox Code Playgroud)

可能是简单的事情.非常感谢任何帮助.谢谢!

Mac OS X Lion 10.7.5
homebrew 0.9.3
postgres 9.2.1
Run Code Online (Sandbox Code Playgroud)

passwords postgresql homebrew createuser osx-lion

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

为什么我的jQueryUI对话框不会关闭?

为什么我的按钮不会关闭对话框?

这是代码和小提琴http://jsfiddle.net/ThxjS/

$(function() {
    $( "<div id='dialogMy'><button>close</button>test</div>" ).dialog({

        resizable: false,
        height:140,
        modal: true

    });


          $("button").click(function(){

                 //why wont it close? 
                  //$('#dialogMy').close();
                  $('#dialogMy').destroy();

          });

});
Run Code Online (Sandbox Code Playgroud)

jquery jquery-ui

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

边界和保证金问题

没有示例很难解释,所以这里是http://jsfiddle.net/dvXhP/2/的例子

您可以看到,当您单击按钮删除时,此事件将触发 -

$('#button #remove').click(function() {
    $('#borderDiv').css('border','0px solid red'); 
});
Run Code Online (Sandbox Code Playgroud)

这基本上是删除div周围的边框,但看看按钮是如何跳到底部的......

我意识到,如果删除#borderDiv中的#text div,问题将得到解决(但我需要知道如何修复问题而不删除它).

我也意识到按钮跳到底部等于#text div的上边距,这很奇怪......

所以请帮我解决这个问题!
我在大项目上工作,jsfiddle的例子只是为了解释这个问题..谢谢!

html css jquery margin

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