- 浏览: 6768 次
- 性别:
- 来自: 深圳
最新评论
文章列表
js:
URL编码 var factoryName = encodeURIComponent(factoryName);
URL解码 var factoryName = decodeURIComponent(factoryName);
java:
URL编码 String enstr = URLEncoder.encode(str2,"gb2312");
URL解码 String destr = URLDecoder.decode(str, "gb2312");
...
这是因为firefox安全性强,不允许跨域调用。
Firefox 要取消XMLHttpRequest的跨域限制的话,
第一是从 about:config 里设置 signed.applets.codebase_principal_support = true; (地址栏输入about:config 即可进行firefox设置)
第二就是在open的代码函数前加入类似如下的代码:
try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); } catch (e) { ...
- 2009-09-09 15:26
- 浏览 1046
- 评论(0)
//生产
package test_produce;
public class Produce implements Runnable{
Stack_used su;
public Produce(){}
public Produce(Stack_used su){
this.su = su;
}
//这里以生产100次为例
public void run(){
for(int i = 0; i < 100; i++){
su.pushOne(i);
}
}
}
//消费
package te ...
- 2009-07-29 21:47
- 浏览 870
- 评论(0)
package lianxi;
public class Singleton {//懒汉式单例设计模式
private static Singleton st;
private Singleton(){}
public static Singleton getInstance(){
if(st == null){
st = new Singleton();
}
return st;
}
public static void main(String[] args){//验证
Singleton s1 = Singleton ...
- 2009-05-20 22:01
- 浏览 935
- 评论(0)
package day1201;
import java.util.HashMap;
import java.util.Map;
public class Course {
public static Map<String,Integer> hm = new HashMap();
private String course;//课程名
public Course(){}
public Course(String course){
this.setCourse(course);
hm.put(course, 0);
}
p ...
- 2009-05-19 22:13
- 浏览 1548
- 评论(0)
public class TestRandom
{
//实现生成10个1-100之间的随机数
final static int NUM1 = 10;
final static int NUM2 = 100;
private int a[] = new int[NUM1];
private int b[] = new int[NUM2];
public void random()
{
for(int i = 0 ; i < b.length ;i++)
{
b[i] = i + 1;
}
for(int i = 0 ; i < a.length ...
- 2009-05-01 00:11
- 浏览 923
- 评论(0)