我的評論
re: Find a way out of the ClassLoader maze---走出ClassLoader迷宮 Web 2.0 技術資源 2011-09-05 11:14
辛苦了,中秋快樂!
re: [原創]美女圖片爬蟲程序實戰!~用技術創造快感! Web 2.0 技術資源 2011-07-01 10:51
2.7. HttpClient proxy configuration
Even though HttpClient is aware of complex routing scemes and proxy chaining, it supports only simple direct or one hop proxy connections out of the box.
The simplest way to tell HttpClient to connect to the target host via a proxy is by setting the default proxy parameter:
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpHost proxy = new HttpHost("someproxy", 8080);
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
One can also instruct HttpClient to use the standard JRE proxy selector to obtain proxy information:
DefaultHttpClient httpclient = new DefaultHttpClient();
ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
httpclient.getConnectionManager().getSchemeRegistry(),
ProxySelector.getDefault());
httpclient.setRoutePlanner(routePlanner);
Alternatively, one can provide a custom RoutePlanner implementation in order to have a complete control over the process of HTTP route computation:
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.setRoutePlanner(new HttpRoutePlanner() {
public HttpRoute determineRoute(
HttpHost target,
HttpRequest request,
HttpContext context) throws HttpException {
return new HttpRoute(target, null, new HttpHost("someproxy", 8080),
"https".equalsIgnoreCase(target.getSchemeName()));
}
});
Even though HttpClient is aware of complex routing scemes and proxy chaining, it supports only simple direct or one hop proxy connections out of the box.
The simplest way to tell HttpClient to connect to the target host via a proxy is by setting the default proxy parameter:
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpHost proxy = new HttpHost("someproxy", 8080);
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
One can also instruct HttpClient to use the standard JRE proxy selector to obtain proxy information:
DefaultHttpClient httpclient = new DefaultHttpClient();
ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
httpclient.getConnectionManager().getSchemeRegistry(),
ProxySelector.getDefault());
httpclient.setRoutePlanner(routePlanner);
Alternatively, one can provide a custom RoutePlanner implementation in order to have a complete control over the process of HTTP route computation:
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.setRoutePlanner(new HttpRoutePlanner() {
public HttpRoute determineRoute(
HttpHost target,
HttpRequest request,
HttpContext context) throws HttpException {
return new HttpRoute(target, null, new HttpHost("someproxy", 8080),
"https".equalsIgnoreCase(target.getSchemeName()));
}
});
re: [原創]自己封裝了個Tab標簽控件,效果和瀏覽器一樣。 Web 2.0 技術資源 2011-05-23 11:15
@麥胖
呵呵,謝謝贊賞。
請把你修改后的代碼發到的郵箱 wellse@qq.com 我看下。
呵呵,謝謝贊賞。
請把你修改后的代碼發到的郵箱 wellse@qq.com 我看下。
re: window.setTimeout() & window.setInterval() 使用方式與參數傳遞問題! Web 2.0 技術資源 2011-04-17 18:07
q@ice
請學習下Javascript的閉包特性,你就明白啦!
請學習下Javascript的閉包特性,你就明白啦!
re: [原創]自己封裝了個Tab標簽控件,效果和瀏覽器一樣。 Web 2.0 技術資源 2010-07-12 10:18
@余如水
給我找個工作嘛~~
給我找個工作嘛~~
re: 我的書出版了 Web 2.0 技術資源 2010-04-28 10:22
恭喜,恭喜
re: [原創] Javascript 封裝 HashMap v1.1 ...... [充分利用Javascript 的特性 80 行代碼實現] Web 2.0 技術資源 2009-01-06 17:42
謝謝樓上的兄弟! 對頭................. 的確存在那樣的問題。
沒考慮周全。
沒考慮周全。
re: 源碼分析:HashMap Web 2.0 技術資源 2008-08-27 11:37
#########################################
void transfer(Entry[] newTable) {
Entry[] src = table;
int newCapacity = newTable.length;
for (int j = 0; j < src.length; j++) {
Entry e = src[j];
if (e != null) {
src[j] = null;
do {
Entry next = e.next;
int i = indexFor(e.hash, newCapacity);
e.next = newTable[i];
newTable[i] = e;
e = next;
} while (e != null);
}
}
}
遍歷原來的數組,如果該Entry不是null的話,說明有映射,然后遍歷這個鏈表,把所有的映射插入到新的數組中,注意這里要從新計算索引位置。
#########################################
Entry next = e.next;
int i = indexFor(e.hash, newCapacity);
e.next = newTable[i]; ?????????
newTable[i] = e; ?????????
為什么 e.next 要指向自己呢?
void transfer(Entry[] newTable) {
Entry[] src = table;
int newCapacity = newTable.length;
for (int j = 0; j < src.length; j++) {
Entry e = src[j];
if (e != null) {
src[j] = null;
do {
Entry next = e.next;
int i = indexFor(e.hash, newCapacity);
e.next = newTable[i];
newTable[i] = e;
e = next;
} while (e != null);
}
}
}
遍歷原來的數組,如果該Entry不是null的話,說明有映射,然后遍歷這個鏈表,把所有的映射插入到新的數組中,注意這里要從新計算索引位置。
#########################################
Entry next = e.next;
int i = indexFor(e.hash, newCapacity);
e.next = newTable[i]; ?????????
newTable[i] = e; ?????????
為什么 e.next 要指向自己呢?
re: [原創] 一個完善的輕量級分頁API Pager ! 有源代碼....... Web 2.0 技術資源 2008-01-24 20:43
@sly
報什么錯啊........ 不得哦!
報什么錯啊........ 不得哦!
re: [原創] Javascript 封裝 HashMap v1.1 ...... [充分利用Javascript 的特性 80 行代碼實現] Web 2.0 技術資源 2008-01-09 15:21
@js
設計這個Map 主要是為了填補 Javascript 中沒有Map工具的不足。
你覺得你用Array 來代替 Map 那樣你寫的Javascript 會清晰明了嗎?
那在Java里面何必需要HashSet, 直接用HashMap也能實現~
關鍵是讓自己編碼更清晰.... 數據類型更明了。
設計這個Map 主要是為了填補 Javascript 中沒有Map工具的不足。
你覺得你用Array 來代替 Map 那樣你寫的Javascript 會清晰明了嗎?
那在Java里面何必需要HashSet, 直接用HashMap也能實現~
關鍵是讓自己編碼更清晰.... 數據類型更明了。
re: Struts+Hibernate實現shopcart Web 2.0 技術資源 2007-05-25 20:54
做個服務層吧~
把業務邏輯集中到 Service
把業務邏輯集中到 Service
re: Struts+Hibernate實現shopcart Web 2.0 技術資源 2007-05-25 10:21
你應該對 collection 框架還不夠熟悉~ 加強下就OK了~
re: Struts+Hibernate實現shopcart Web 2.0 技術資源 2007-05-25 09:59
看錯意圖了~ 這樣就OK了~
return new ArrayList( hs.values() );
return new ArrayList( hs.values() );
re: Struts+Hibernate實現shopcart Web 2.0 技術資源 2007-05-25 09:31
頭都大了~~
// 將hashmap中value轉到list中
public static List getList(HashMap hs) {
List list = new ArrayList();
Iterator itr = hs.keySet().iterator();
while (itr.hasNext()) {
list.add(hs.get(itr.next()));
}
return list;
}
return new ArrayList( hs.keySet() );
就可以了撒,多麻煩的。
// 將hashmap中value轉到list中
public static List getList(HashMap hs) {
List list = new ArrayList();
Iterator itr = hs.keySet().iterator();
while (itr.hasNext()) {
list.add(hs.get(itr.next()));
}
return list;
}
return new ArrayList( hs.keySet() );
就可以了撒,多麻煩的。
re: 關于java class loader的理解筆記 Web 2.0 技術資源 2007-04-11 14:27
好玩!!!!!!!!
re: 初始化有序常量的一點小技巧 Web 2.0 技術資源 2007-04-11 11:16
嘿嘿!~
re: 做了Firefox下的一個擴展,它的設計理念真的是非常超前啊 Web 2.0 技術資源 2007-01-25 12:09
莫名其妙.......... 不過還是辛苦了.
re: xjl:關于String類的split方法 Web 2.0 技術資源 2007-01-25 12:06
雖然使用正則表達式能很好的進行字符串的解析、提取、替換,但是對于一些簡單的應用,使用 String 類提供的一些方法就可以很好的完成,最突出的就是 split 方法。
和后面說的矛盾了..........
和后面說的矛盾了..........
re: [原創]prototype對于標簽定位的一些BUG Web 2.0 技術資源 2006-12-10 20:50
Object is positioned relative to parent element's position—or to the body object if its parent element is not positioned—using the top and left properties.
查文檔才是王道!~
查文檔才是王道!~
re: 歡迎加入成都java俱樂部 Web 2.0 技術資源 2006-11-30 20:02
BLOG ID: fantasy
QQ:8635335
期待加入ing .......
QQ:8635335
期待加入ing .......
re: JS實現文本框輸入提供選擇框的提示功能-1 Web 2.0 技術資源 2006-11-23 22:52
Javascript 也應該面向對象呀~ 老大..........
re: 值得重視的Comparable接口 Web 2.0 技術資源 2006-11-03 21:41
策略模式.... 鑒定完畢......
re: 空(標識)接口的重要性 Web 2.0 技術資源 2006-10-29 14:36
經典~! 很不錯~~~
不幸的是..... 我還貼著菜鳥的標簽.........
不幸的是..... 我還貼著菜鳥的標簽.........
re: [經典]在Mozilla中使用XML和JavaScript....... Web 2.0 技術資源 2006-10-26 23:59
其實我已經給你提供API了....... 可是你把他給改了....... 最可怕的是改錯了
if (moz)
{
xmlDoc = document.implementation.createDocument("", "", null);
/*這里錯大了!
readXML(xmlDoc);
*/
/*正確方式*/
xmlDoc.load( file );
xmlDoc.onload = function(){ readXML(xmlDoc); }
}
/********************* 代碼 ***********************/
<script language="javascript">
function importXML(file)
{
var xmlDoc=null;
var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument !='undefined');
var ie = (typeof window.ActiveXObject != 'undefined');
if (moz)
{
xmlDoc = document.implementation.createDocument("", "", null);
/*這里錯大了!
readXML(xmlDoc);
*/
/*正確方式*/
xmlDoc.load( file );
xmlDoc.onload = function(){ readXML(xmlDoc); }
}
else if (ie)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.onreadystatechange = function()
{
if(xmlDoc.readyState == 4) readXML(xmlDoc);
}
xmlDoc.load(file);
}
}
function readXML( xmlDocObj )
{
var company = xmlDocObj.getElementsByTagName("company");
window.alert(company.length);
}
function doXML()
{
importXML("11.xml");
}
</script>
if (moz)
{
xmlDoc = document.implementation.createDocument("", "", null);
/*這里錯大了!
readXML(xmlDoc);
*/
/*正確方式*/
xmlDoc.load( file );
xmlDoc.onload = function(){ readXML(xmlDoc); }
}
/********************* 代碼 ***********************/
<script language="javascript">
function importXML(file)
{
var xmlDoc=null;
var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument !='undefined');
var ie = (typeof window.ActiveXObject != 'undefined');
if (moz)
{
xmlDoc = document.implementation.createDocument("", "", null);
/*這里錯大了!
readXML(xmlDoc);
*/
/*正確方式*/
xmlDoc.load( file );
xmlDoc.onload = function(){ readXML(xmlDoc); }
}
else if (ie)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.onreadystatechange = function()
{
if(xmlDoc.readyState == 4) readXML(xmlDoc);
}
xmlDoc.load(file);
}
}
function readXML( xmlDocObj )
{
var company = xmlDocObj.getElementsByTagName("company");
window.alert(company.length);
}
function doXML()
{
importXML("11.xml");
}
</script>
re: Javascript 中的 Visitor 模式 → 實現樹型結構任意節點遍歷................ Web 2.0 技術資源 2006-10-25 23:13
沒實現 Visitor 和 Visitable 接口的 Visitor 模式.......
哈哈........ 感覺已經變成簡單的策略模式了........
實在不好意思......... 有點變味了.........
哈哈........ 感覺已經變成簡單的策略模式了........
實在不好意思......... 有點變味了.........
re: 您不得不關注的成長群體 Web 2.0 技術資源 2006-10-25 22:57
"有志于實現四個現代化的青壯年"..............
哈哈哈!!!!!!!!!!
很有趣啊~ 可惜偶老了.............
哈哈哈!!!!!!!!!!
很有趣啊~ 可惜偶老了.............
re: JavaScript For Beginners(轉載) Web 2.0 技術資源 2006-10-25 20:05
俺是中國人........ 看不懂E文..........
re: [譯]外觀設計模式(The Facade Pattern) From Chapter 6 of《Design Patterns Explained》 Web 2.0 技術資源 2006-10-25 20:04
不錯! 總算看到另外一個版本的 外觀模式介紹了...........
感謝ing
感謝ing
re: [經典]在Mozilla中使用XML和JavaScript....... Web 2.0 技術資源 2006-10-25 19:43
估計是你加載 XML 的方式沒對。
請參考:
function loadXML(file)
{
var xml = null;
var ie = (typeof window.ActiveXObject != 'undefined');
var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');
if (moz)
{
xml = document.implementation.createDocument("", "", null)
xml.load(file);
xml.onload = function ()
{
viewData(xml);
}
}
else if (ie)
{
xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
xml.load(file);
if(xml.readyState == 4)
{
viewData(xml);
}
}
}
參考地址 : http://bbs1.softhouse.com.cn/index.htm?url=/forum/help/user/index.jsp
請參考:
function loadXML(file)
{
var xml = null;
var ie = (typeof window.ActiveXObject != 'undefined');
var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');
if (moz)
{
xml = document.implementation.createDocument("", "", null)
xml.load(file);
xml.onload = function ()
{
viewData(xml);
}
}
else if (ie)
{
xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
xml.load(file);
if(xml.readyState == 4)
{
viewData(xml);
}
}
}
參考地址 : http://bbs1.softhouse.com.cn/index.htm?url=/forum/help/user/index.jsp
re: [原創] Javascript 封裝 HashMap v1.1 ...... [充分利用Javascript 的特性 80 行代碼實現] Web 2.0 技術資源 2006-10-22 12:08
修正了一個嚴重的BUG .
情況1
var array = new Array();
array.push("A"); array.length = 1
情況2 (想當然的為初始化長度,以為那樣效率可以高那么一點點........)
var array = new Array( 3 );
array.push("A"); array.length = 4
區別大呢............. 不像JAVA里面....
他爺爺的~~!
情況1
var array = new Array();
array.push("A"); array.length = 1
情況2 (想當然的為初始化長度,以為那樣效率可以高那么一點點........)
var array = new Array( 3 );
array.push("A"); array.length = 4
區別大呢............. 不像JAVA里面....
他爺爺的~~!
re: 在java中使用循環定義會出現哪些問題? Web 2.0 技術資源 2006-10-19 21:13
誰這樣寫代碼~ 就槍斃他!
re: [原創] 一個完善的輕量級分頁API Pager ! 有源代碼....... Web 2.0 技術資源 2006-10-17 22:59
該 Pager 能使用于任何WEB容器。
關鍵是怎么使用他。
關鍵是怎么使用他。
re: 對"類"和"對象"的深度揣摩與思考...(java初學者) Web 2.0 技術資源 2006-10-14 21:54
果然夠深度! 支持!! 頂!
re: 按字節截取含雙字節的字符串! Web 2.0 技術資源 2006-10-13 21:12
效率太低了...........
給個簡單的處理方式吧~~~
public static String getShorterString( String input , int bytes )
{
try
{
byte[] array = input.getBytes("GBK");
if( bytes >= array.length ) return input;
String result = new String(array , 0 , bytes ,"GBK");
return result.length() > 0 ? result : new String(array , 0 , bytes - 1 ,"GBK");
}
catch (UnsupportedEncodingException e)
{
return input;
}
}
給個簡單的處理方式吧~~~
public static String getShorterString( String input , int bytes )
{
try
{
byte[] array = input.getBytes("GBK");
if( bytes >= array.length ) return input;
String result = new String(array , 0 , bytes ,"GBK");
return result.length() > 0 ? result : new String(array , 0 , bytes - 1 ,"GBK");
}
catch (UnsupportedEncodingException e)
{
return input;
}
}
re: 芒果軟件實驗室 誠攬人才 Web 2.0 技術資源 2006-09-11 17:46
拼命打撒~~~
打不過就撤退~~~~~~~~
沒的撤的地方了~~~ 就同志們就頂住!
打不過就撤退~~~~~~~~
沒的撤的地方了~~~ 就同志們就頂住!
re: [原創] Javascript 封裝 HashMap v1.1 ...... [充分利用Javascript 的特性 80 行代碼實現] Web 2.0 技術資源 2006-08-15 10:48
@譚立平
謝謝 樓上的兄弟提出的BUG ~ 不過我自己測還沒測出這個問題......
再次去參考了文檔 :
/***********************************************/
delete 運算符
從對象中刪除一個屬性,或從數組中刪除一個元素。
delete expression
expression 參數是一個有效的 JScript 表達式,通常是一個屬性名或數組元素。
說明
如果 expression 的結果是一個對象,且在 expression 中指定的屬性存在,而該對象又不允許它被刪除,則返回 false。
在所有其他情況下,返回 true。
/***********************************************/
在刪除元素的時候增加了~ this.containsKey(key) 的條件限制。
增加了 clear 方法。
謝謝 樓上的兄弟提出的BUG ~ 不過我自己測還沒測出這個問題......
再次去參考了文檔 :
/***********************************************/
delete 運算符
從對象中刪除一個屬性,或從數組中刪除一個元素。
delete expression
expression 參數是一個有效的 JScript 表達式,通常是一個屬性名或數組元素。
說明
如果 expression 的結果是一個對象,且在 expression 中指定的屬性存在,而該對象又不允許它被刪除,則返回 false。
在所有其他情況下,返回 true。
/***********************************************/
在刪除元素的時候增加了~ this.containsKey(key) 的條件限制。
增加了 clear 方法。
re: 別忘了轉義\\ Web 2.0 技術資源 2006-05-30 15:21
啊........ 就怎么點啊...... 暈.....
re: [原創] Javascript 封裝 HashMap v1.1 ...... [充分利用Javascript 的特性] Web 2.0 技術資源 2006-05-08 23:53
@dennis
謝謝支持!
這個是在我上次寫的HashMap上完全改進的~~~
謝謝 bbs.51js.com 上的朋友提出寶貴的意見。
謝謝支持!
這個是在我上次寫的HashMap上完全改進的~~~
謝謝 bbs.51js.com 上的朋友提出寶貴的意見。
re: 防止任意形式的重復提交 Web 2.0 技術資源 2006-05-06 17:52
Struts 的 Token 機制可以解決這個問題。
如果沒用Struts 怎么辦哇 .................. 郁悶。
如果沒用Struts 怎么辦哇 .................. 郁悶。
re: [原創] 用 Javascript 封裝了一個HashMap ..... 希望大家多多指教! Web 2.0 技術資源 2006-04-18 09:23
/** key允許空值但hashcode方法卻沒有對其進行空值檢查? **/
這個的確是問題............. 但是我不想考慮太多的因素進去......
我覺得那些應該由用戶自己來檢查.....
否則會讓正個代碼變得很郁悶........... 郁悶拉。 55555555555
這個的確是問題............. 但是我不想考慮太多的因素進去......
我覺得那些應該由用戶自己來檢查.....
否則會讓正個代碼變得很郁悶........... 郁悶拉。 55555555555
re: [原創] 用 Javascript 封裝了一個HashMap ..... 希望大家多多指教! Web 2.0 技術資源 2006-04-18 09:15
/**
resize要個_this參數干嘛用?
**/
是為了解決 用 var 定義的方法不能調用 this 方法... [私有不能訪問公有方法]
所以得顯示的傳遞一個 this 對象。
resize要個_this參數干嘛用?
**/
是為了解決 用 var 定義的方法不能調用 this 方法... [私有不能訪問公有方法]
所以得顯示的傳遞一個 this 對象。
re: [原創] 用 Javascript 封裝了一個HashMap ..... 希望大家多多指教! Web 2.0 技術資源 2006-04-18 09:12
/**
if(++code > length){
code = 0;
}
干什么用?hashcode居然和length綁在一起,感覺很怪。。。
**/
因為如果當前位置發生沖突.......... 則向后查找.. 如果 > length 則 置0 。
if(++code > length){
code = 0;
}
干什么用?hashcode居然和length綁在一起,感覺很怪。。。
**/
因為如果當前位置發生沖突.......... 則向后查找.. 如果 > length 則 置0 。
re: 具有臭味的代碼 Web 2.0 技術資源 2006-03-24 09:34
暈~~~ 這臭味也太多拉......... 55555555555