小编Kev*_*vin的帖子

弱参考和强参考

package uk.co.bigroom.utils 
{
    import flash.utils.Dictionary;
    /**
     * Class to create a weak reference to an object. A weak reference
     * is a reference that does not prevent the object from being
     * garbage collected. If the object has been garbage collected
     * then the get method will return null.
     */
    public class WeakRef
    {
        private var dic:Dictionary;

        /**
         * The constructor - creates a weak reference.
         * 
         * @param obj the object to create a weak reference to
         */
        public …
Run Code Online (Sandbox Code Playgroud)

apache-flex actionscript

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

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

不可变对象和延迟初始化.

http://www.javapractices.com/topic/TopicAction.do?Id=29

以上是我正在看的文章.不可变对象大大简化了程序,因为它们:

允许hashCode使用延迟初始化,并缓存其返回值

  • 任何人都可以解释一下作者在上述内容上试图说的话.
  • 是我的班immutable,如果其标记为final和实例变量仍然不是最终版本,vice-versa my instance variables being finalclass being normal.

java

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

PHP中未定义的变量错误

Notice: Undefined variable: username in C:\xampp\htdocs\test_class.php
        on line 20
Notice: Undefined variable: password in C:\xampp\htdocs\test_class.php
        on line 20
Run Code Online (Sandbox Code Playgroud)

当我使用这段代码检查我的数据库的用户名和密码时,我收到上述错误.

<?php
    class test_class {

        public function __construct() { 

        }
        public function doLogin() {

            include("connection.php");

            if (isset($_POST['username']))
                {
                $username= $_POST['username'];
                }
                if (isset($_POST['password']))
                {
                $password= $_POST['password'];
                } 

            $query = "SELECT * FROM users WHERE username = '$username' AND password = '$password'";
            $result = mysql_fetch_array(mysql_query($query));
            if(!$result)

            {

            return 'assa';

            }else{

            return 'assa112121212';

            }

                }
        }
?>
Run Code Online (Sandbox Code Playgroud)

php mysql

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

javascript中的引用类型

obj = {
  go: function() { alert(this) }
}

obj.go(); // object

(obj.go)(); // object

(a = obj.go)(); // window

(0 || obj.go)(); // window
Run Code Online (Sandbox Code Playgroud)

任何人都可以解释为什么后两个打印窗口对象和前两个打印引用.

javascript

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

使用express.js和node.js运行我的示例应用程序

var sys = require("sys"),  
my_http = require("http");  
my_http.createServer(function(request,response){  
    sys.puts("I got kicked");  
    response.writeHeader(200, {"Content-Type": "text/plain"});  
    response.write("Hello World");  
    response.end();  
}).listen(8080);  
sys.puts("Server Running on 8080");
Run Code Online (Sandbox Code Playgroud)

以上是我的基本web服务器,现在我想运行包含HTML和JS文件的应用程序.我会在哪里放置这些文件,以便我可以通过我的端口访问它.

我使用Apache and Xampp,所以我将我的文件放在htdocs目录中并通过我的浏览器访问它,但就node.js我而言,我完全糊涂了?

javascript node.js

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

MySQL中的插入失败错误

while($row=mysql_fetch_array($result2)){    
        //return $row['ProjectID'];
        $sql="INSERT INTO `tycodashboard` (ProjectID,DesignationID,ReqcompID,IntOrgID,FinishedTimeID,ProjectStatusID,PhaseID
                ) VALUES('{$row['ProjectID']}','$pm,'$req','$initiating,'$initiating','$ftime,'$ProjectStatus,'$Phase)";
        $result=mysql_query($sql);
        if(!$result){
            if(mysql_errno() == ER_DUP_ENTRY){
                throw new Exception("INSERT FAILED.\n\nThe database already contains a Project with the Project Name \"$ldesc\", please pick another.");
            }else{
                throw new Exception("INSERT FAILED.\n\n".mysql_error());
            }
        }
        }//exits

    INSERT FAILED.

    You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the 
right syntax to use near '3','2,'2','2,'2,'3)' at line 2
Run Code Online (Sandbox Code Playgroud)

php mysql

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

对象和字符串对象有什么区别

我想我已经迷失了基础知识本身。这两者有什么区别呢。String对象是String类的一个实例。

var guru:Object = new Object();

var guru:String = new String();
Run Code Online (Sandbox Code Playgroud)

apache-flex object

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

Java中的迭代器

什么是迭代器和集合?这两个有关系吗?

// the interface definition
Interface Iterator {
    boolean hasNext();
    Object next(); // note "one-way" traffic
    void remove();
}

// an example
public static void main (String[] args){
    ArrayList cars = new ArrayList();

    for (int i = 0; i < 12; i++)
        cars.add (new Car());

    Iterator it = cats.iterator();

    while (it.hasNext())
        System.out.println ((Car)it.next());
}
Run Code Online (Sandbox Code Playgroud)

Interface Iterator是否单独预定义了这些方法名称或用户定义了哪些方法名称?下面这四行实际上讲的是什么?

cars.add (new Car());
Iterator it = cats.iterator();
while (it.hasNext())
    System.out.println ((Car)it.next());
Run Code Online (Sandbox Code Playgroud)

谢谢.我正在阅读一本收藏的书.

java collections iterator

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

我们需要覆盖哈希码方法吗?

我正在查看java.lang.Object,并在同一主题上阅读StackOverflow中的几个问题.

equals() method用于确定两个对象的相等性.

基本上,如果你想store an object in a collection (Map, Set, List),那么你必须执行根据文档中定义的合同equals和hashCode方法.

如果我错了,请纠正我,如果我没有将我的班级存储在一个集合中,那么我不需要覆盖该hashcode方法,因为该equals方法绰绰有余.

java

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