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) http://www.javapractices.com/topic/TopicAction.do?Id=29
以上是我正在看的文章.不可变对象大大简化了程序,因为它们:
允许hashCode使用延迟初始化,并缓存其返回值
immutable,如果其标记为final和实例变量仍然不是最终版本,vice-versa my instance variables being final和class being normal.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) 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)
任何人都可以解释为什么后两个打印窗口对象和前两个打印引用.
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我而言,我完全糊涂了?
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) 我想我已经迷失了基础知识本身。这两者有什么区别呢。String对象是String类的一个实例。
var guru:Object = new Object();
var guru:String = new String();
Run Code Online (Sandbox Code Playgroud) 什么是迭代器和集合?这两个有关系吗?
// 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.lang.Object,并在同一主题上阅读StackOverflow中的几个问题.
equals() method用于确定两个对象的相等性.
基本上,如果你想store an object in a collection (Map, Set, List),那么你必须执行根据文档中定义的合同equals和hashCode方法.
如果我错了,请纠正我,如果我没有将我的班级存储在一个集合中,那么我不需要覆盖该hashcode方法,因为该equals方法绰绰有余.
apache-flex ×3
java ×3
javascript ×2
mysql ×2
php ×2
actionscript ×1
collections ×1
iterator ×1
node.js ×1
object ×1