97在线观看视频,jizz在线观看,国产日产精品一区 http://www.aygfsteel.com/mrcold/Collect By Finding All The Way ...... zh-cn Sat, 17 May 2025 22:15:33 GMT Sat, 17 May 2025 22:15:33 GMT 60 《編程珠璣》讀書筆記——代碼實現(xiàn) http://www.aygfsteel.com/mrcold/archive/2010/09/05/331085.html胖胖泡泡 胖胖泡泡 Sun, 05 Sep 2010 08:08:00 GMT http://www.aygfsteel.com/mrcold/archive/2010/09/05/331085.html http://www.aygfsteel.com/mrcold/comments/331085.html http://www.aygfsteel.com/mrcold/archive/2010/09/05/331085.html#Feedback 0 http://www.aygfsteel.com/mrcold/comments/commentRss/331085.html http://www.aygfsteel.com/mrcold/services/trackbacks/331085.html 閱讀全文 ]]> JFreeChart http://www.aygfsteel.com/mrcold/archive/2010/06/01/322421.html胖胖泡泡 胖胖泡泡 Tue, 01 Jun 2010 02:37:00 GMT http://www.aygfsteel.com/mrcold/archive/2010/06/01/322421.html http://www.aygfsteel.com/mrcold/comments/322421.html http://www.aygfsteel.com/mrcold/archive/2010/06/01/322421.html#Feedback 0 http://www.aygfsteel.com/mrcold/comments/commentRss/322421.html http://www.aygfsteel.com/mrcold/services/trackbacks/322421.html
http://www.jfree.org/jfreechart/
JFreeChart 目前是最好的java圖形解決方案,基本能夠解決目前的圖形方面的需求,主要包括如下幾個方面:
pie charts (2D and 3D) :餅圖(平面和立體)
bar charts (regular and stacked, with an optional 3D effect) :柱狀圖
line and area charts :曲線圖
scatter plots and bubble charts
time series, high/low/open/close charts and candle stick charts :時序圖
combination charts :復(fù)合圖
Pareto charts
Gantt charts :甘特圖
wind plots, meter charts and symbol charts
wafer map charts
( 態(tài)圖表,餅圖(二維和三維) , 柱狀圖 ( 水平,垂直),線圖,點圖,時間變化圖,甘特圖, 股票行情圖,混和圖, 溫度計圖, 刻度圖等常用商用圖表) ]]>Struts1.x和2.X的一些區(qū)別 http://www.aygfsteel.com/mrcold/archive/2010/06/01/322411.html胖胖泡泡 胖胖泡泡 Tue, 01 Jun 2010 01:39:00 GMT http://www.aygfsteel.com/mrcold/archive/2010/06/01/322411.html http://www.aygfsteel.com/mrcold/comments/322411.html http://www.aygfsteel.com/mrcold/archive/2010/06/01/322411.html#Feedback 0 http://www.aygfsteel.com/mrcold/comments/commentRss/322411.html http://www.aygfsteel.com/mrcold/services/trackbacks/322411.html Struts 從1.1都升成2了,要記錄一下,學(xué)習(xí)起來會方便一些:
1. Struts2 與 Struts1 似乎沒什么血緣關(guān)系了,承自于 WebWork,直害 WebWork 不再推出新版本了,原先的 WebWork 使用者只需順其然,即是水道渠成;相反 Struts1 的開發(fā)經(jīng)驗對于 Struts2 卻沒有太大的幫助。
2. Struts1 的核心控制器是 ActionServlet,而 Struts2 的核心控制器是 FilterDispatcher。Struts2 的業(yè)務(wù) Action 會在運行時生成 Action 代理。
3. Struts1 的 Action 須繼承抽象 Action 類,侵入了 Servlet API;而 Struts2 的 Action 可以實現(xiàn) ActionSupport,或者只要一個純凈的 POJO 來充當(dāng),完全與 Servlet 絕緣。也因此帶來測試性 Struts2 要比 Struts1 強,可把 Struts TestCase 扔到一旁去了。
4. Struts1 在運行時一個 Action 只會生成一個實例,而 Struts2 中的 Action 會應(yīng)對每個請求生成新的實例,在線程安全性方面,Struts1 要多些考慮。
5. Struts1 依靠 ActionForm 來接受數(shù)據(jù),它也是依賴于 Servlet API ,并非普通的 JavaBean,而 Struts2 可在 Action 屬性中獲取請求的屬性,當(dāng)然也能封裝在一個獨立的 POJO 中。不過提醒一下,在 Struts1.3 中也可以用 POJO 來接受請求屬性,但使用起來有點煩瑣。
6. Struts2 使用了新的 OGNL 的表達式語言,可以訪問值棧,在對集合和索引屬性的支持上功能更強大。
7. Struts1 的配置文件只需 struts-config.xml;Struts2 的配置文件有 struts.xml 和 struts.properties。struts.properties 中有兩個 struts.devMode = fase 和 struts.configuration.xml.reload = true 很可愛,分別設(shè)置當(dāng)前是開發(fā)還是生產(chǎn)模式,以及 struts.xml 改變后是否自動重新加載,免去了改配置手工重啟應(yīng)用的必須步驟。
8. Struts2 Action 的 execute() 無參,返回的是一個字符串,不像 Struts1 Action 的 execute() 有一大串且不說,光是返回 ActionForward,就讓這個 Action 與 Struts1 脫不了干系;還是 Struts2 來得聰明,只返回個中性的 String,反正名字嗎,猛然間這個 Action 也成 POJO 了,復(fù)用性增強了,難怪專門有一書,名為《POJO In Action》。
9. Struts1 的視圖只支持 JSP,這也不怪它,只怨出身太早,那時就只有 JSP 一種表現(xiàn)層。相比,Struts2 更有艷福,能貼近于 FreeMarker、Velocity、XSLT、PDF 等視圖技術(shù)。
10. Struts2 提供了功能強大復(fù)雜的標(biāo)簽庫,統(tǒng)一化為 "s" 前綴。并順應(yīng)時代潮流地加入了 AJAX 的支持。還提供了更友好的驗證功能。
]]> 寫文件的亂碼問題 http://www.aygfsteel.com/mrcold/archive/2010/05/27/322052.html胖胖泡泡 胖胖泡泡 Thu, 27 May 2010 08:32:00 GMT http://www.aygfsteel.com/mrcold/archive/2010/05/27/322052.html http://www.aygfsteel.com/mrcold/comments/322052.html http://www.aygfsteel.com/mrcold/archive/2010/05/27/322052.html#Feedback 0 http://www.aygfsteel.com/mrcold/comments/commentRss/322052.html http://www.aygfsteel.com/mrcold/services/trackbacks/322052.html FileOutputStream fileOutputStream = new FileOutputStream(file);
Writer writer = new OutputStreamWriter(fileOutputStream, " UTF8 " );
writer.write(content);
writer.close();
統(tǒng)一為UTF8編碼。 ]]>使用HttpClient對Web Service調(diào)用 http://www.aygfsteel.com/mrcold/archive/2010/05/27/322051.html胖胖泡泡 胖胖泡泡 Thu, 27 May 2010 08:30:00 GMT http://www.aygfsteel.com/mrcold/archive/2010/05/27/322051.html http://www.aygfsteel.com/mrcold/comments/322051.html http://www.aygfsteel.com/mrcold/archive/2010/05/27/322051.html#Feedback 0 http://www.aygfsteel.com/mrcold/comments/commentRss/322051.html http://www.aygfsteel.com/mrcold/services/trackbacks/322051.html 用到的jar包有:
commons-codec-1.3.jar
commons-httpclient-3.0.jar
commons-logging-1.0.4.jar
具體流程大致這樣:
String soapRequestData = " <?xml version=\ " 1.0 \ " encoding=\ " utf - 8 \ " ?> " +
" <soap12:Envelope xmlns:xsi=\ " http: // www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\" http://www.w3.org/2001/XMLSchema \" xmlns:soap12=\" http://www.w3.org/2003/05/soap-envelope \">" +
" <soap12:Body> " +
" <qqCheckOnline xmlns=\ " http: // WebXml.com.cn/\">" +
" <qqCode>349104641</qqCode> " +
" </qqCheckOnline> " +
" </soap12:Body> " +
" </soap12:Envelope> " ;
System.out.println(soapRequestData);
// PostMethod postMethod = new PostMethod(" http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl ");
PostMethod postMethod = new PostMethod( " http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?wsdl " );
// 然后把Soap請求數(shù)據(jù)添加到PostMethod中
byte [] b = soapRequestData.getBytes( " utf-8 " );
InputStream is = new ByteArrayInputStream(b, 0 ,b.length);
RequestEntity re = new InputStreamRequestEntity(is,b.length, " application/soap+xml; charset=utf-8 " );
postMethod.setRequestEntity(re);
// 最后生成一個HttpClient對象,并發(fā)出postMethod請求
HttpClient httpClient = new HttpClient();
int statusCode = httpClient.executeMethod(postMethod);
String soapResponseData = postMethod.getResponseBodyAsString();
System.out.print(soapResponseData);
動態(tài)構(gòu)造調(diào)用串的話如下實現(xiàn):
private String tns;
private String methodName;
private String wsdlLocation;
private String soapResponseData;
private int invoke(Map < String, String > patameterMap) throws Exception {
PostMethod postMethod = new PostMethod(wsdlLocation);
String soapRequestData = buildRequestData(patameterMap);
byte [] bytes = soapRequestData.getBytes( " utf-8 " );
InputStream inputStream = new ByteArrayInputStream(bytes, 0 ,
bytes.length);
RequestEntity requestEntity = new InputStreamRequestEntity(inputStream,
bytes.length, " application/soap+xml; charset=utf-8 " );
postMethod.setRequestEntity(requestEntity);
HttpClient httpClient = new HttpClient();
int statusCode = httpClient.executeMethod(postMethod);
soapResponseData = postMethod.getResponseBodyAsString();
return statusCode;
}
private String buildRequestData(Map < String, String > patameterMap) {
StringBuffer soapRequestData = new StringBuffer();
soapRequestData.append( " <?xml version=\ " 1.0 \ " encoding=\ " utf - 8 \ " ?> " );
soapRequestData
.append( " <soap12:Envelope xmlns:xsi=\ " http: // www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\" http://www.w3.org/2001/XMLSchema \" xmlns:soap12=\" http://www.w3.org/2003/05/soap-envelope \">");
soapRequestData.append( " <soap12:Body> " );
soapRequestData.append( " < " + methodName + " xmlns=\ "" + tns + " \ " > " );
Set < String > nameSet = patameterMap.keySet();
for (String name : nameSet) {
soapRequestData.append( " < " + name + " > " + patameterMap.get(name)
+ " </ " + name + " > " );
}
soapRequestData.append(" </ " + methodName + " > " );
soapRequestData.append( " </soap12:Body> " );
soapRequestData.append( " </soap12:Envelope> " );
return soapRequestData.toString();
} ]]> 關(guān)于static的濫用 http://www.aygfsteel.com/mrcold/archive/2010/05/27/322050.html胖胖泡泡 胖胖泡泡 Thu, 27 May 2010 08:24:00 GMT http://www.aygfsteel.com/mrcold/archive/2010/05/27/322050.html http://www.aygfsteel.com/mrcold/comments/322050.html http://www.aygfsteel.com/mrcold/archive/2010/05/27/322050.html#Feedback 0 http://www.aygfsteel.com/mrcold/comments/commentRss/322050.html http://www.aygfsteel.com/mrcold/services/trackbacks/322050.html 最近發(fā)掘越來越習(xí)慣于使用靜態(tài)的方法和屬性,也由此犯了許多錯誤。簡直是濫用。
如在一個servlet中,聲明了userId這種靜態(tài)屬性。勢必會導(dǎo)致多用戶訪問時操作同一個userId對象,引發(fā)并發(fā)性問題。
對于這種不同用戶會產(chǎn)生不同值的屬性,千萬不能定義成static。
static只使用于,對與所有用戶來說,值都能夠保持一致的屬性。比如Hibernate Factory中的數(shù)據(jù)庫連接對象等等。這樣還能夠提高效率,因為static屬性只在類初始化時進行一次初始化。 ]]> Java中AutoBoxing對-128~127整型的特殊處理 http://www.aygfsteel.com/mrcold/archive/2010/05/27/322046.html胖胖泡泡 胖胖泡泡 Thu, 27 May 2010 08:19:00 GMT http://www.aygfsteel.com/mrcold/archive/2010/05/27/322046.html http://www.aygfsteel.com/mrcold/comments/322046.html http://www.aygfsteel.com/mrcold/archive/2010/05/27/322046.html#Feedback 0 http://www.aygfsteel.com/mrcold/comments/commentRss/322046.html http://www.aygfsteel.com/mrcold/services/trackbacks/322046.html public static void main(String[] args) {
Integer a ;
Integer b ;
a = 16 ;
b = 16 ;
System.out.println(a == b);
System.out.println(a.equals(b));
}
輸出true true
public static void main(String[] args) {
Integer a ;
Integer b ;
a = 128 ;
b = 128 ;
System.out.println(a == b);
System.out.println(a.equals(b));
}
輸出false true
public static void main(String[] args) {
Integer a = new Integer( 5 );
Integer b = new Integer( 5 );
System.out.println(a == b);
System.out.println(a.equals(b));
}
輸出false ture ]]>Java的String池 http://www.aygfsteel.com/mrcold/archive/2010/05/27/322023.html胖胖泡泡 胖胖泡泡 Thu, 27 May 2010 06:00:00 GMT http://www.aygfsteel.com/mrcold/archive/2010/05/27/322023.html http://www.aygfsteel.com/mrcold/comments/322023.html http://www.aygfsteel.com/mrcold/archive/2010/05/27/322023.html#Feedback 0 http://www.aygfsteel.com/mrcold/comments/commentRss/322023.html http://www.aygfsteel.com/mrcold/services/trackbacks/322023.html public class Test {
public static void main(String[] args) {
String s = new String();
int a = fun(s);
System.out.println(s);
}
public static int fun(String s)
{
s = " aaaa " ;
return 1 ;
}
}
由于JavaString池的特性,即String不可修改,修改即拋棄舊的,重新創(chuàng)建新的。所以上述代碼輸出為空。如果改為StringBuffer等其他類,則輸出為"aaaa"。 ]]>IBM DW 的Json入門 http://www.aygfsteel.com/mrcold/archive/2009/12/07/304970.html胖胖泡泡 胖胖泡泡 Mon, 07 Dec 2009 02:37:00 GMT http://www.aygfsteel.com/mrcold/archive/2009/12/07/304970.html http://www.aygfsteel.com/mrcold/comments/304970.html http://www.aygfsteel.com/mrcold/archive/2009/12/07/304970.html#Feedback 0 http://www.aygfsteel.com/mrcold/comments/commentRss/304970.html http://www.aygfsteel.com/mrcold/services/trackbacks/304970.html
http://www.ibm.com/developerworks/cn/web/wa-lo-json/
掌握 Ajax,第 10 部分: 使用 JSON 進行數(shù)據(jù)傳輸
http://www.ibm.com/developerworks/cn/web/wa-ajaxintro10/
掌握 Ajax,第 11 部分: 服務(wù)器端的 JSON
http://www.ibm.com/developerworks/cn/web/wa-ajaxintro11.html ]]> Json基本知識 http://www.aygfsteel.com/mrcold/archive/2009/12/07/304966.html胖胖泡泡 胖胖泡泡 Mon, 07 Dec 2009 02:26:00 GMT http://www.aygfsteel.com/mrcold/archive/2009/12/07/304966.html http://www.aygfsteel.com/mrcold/comments/304966.html http://www.aygfsteel.com/mrcold/archive/2009/12/07/304966.html#Feedback 0 http://www.aygfsteel.com/mrcold/comments/commentRss/304966.html http://www.aygfsteel.com/mrcold/services/trackbacks/304966.html JSON 是 javascript 的一個子集,所以,在javascript 中使用JSON 是非常簡單的。
js 代碼
var myJSONObject = { "bindings" : [
{"ircEvent" : "PRIVMSG" , "method" : "newURI" , "regex" : "^http://.*" },
{"ircEvent" : "PRIVMSG" , "method" : "deleteURI" , "regex" : "^delete.*" },
{"ircEvent" : "PRIVMSG" , "method" : "randomURI" , "regex" : "^random.*" }
]
};
在上面的例子中,我們創(chuàng)建了只包含一個成員 "bindings" 的一個對象,bindings 則包含了一個由3個對象組成的數(shù)組。這3個對象都包含3個成員: "ircEvent", "method" , "regex"。
在javascript 中, 成員可以通過“點號”來獲取。
比如:
js 代碼
myJSONObject.bindings[0].method
通過eval() 函數(shù)可以將JSON 字符串轉(zhuǎn)化為對象。
js 代碼
var myObject = eval('(' + myJSONtext + ')');
eval 函數(shù)非常快,但是它可以編譯任何 javascirpt 代碼,這樣的話就可能產(chǎn)生安全的問題。eval 的使用是基于傳入的代碼參數(shù)是可靠的假設(shè)的,有一些情況下,可能客戶端是不可信任的。
如果基于安全的考慮的話,最好是使用一個 JSON 解析器。 一個 JSON 解析器將只接受 JSON 文本。所以是更安全的。
js 代碼
var myObject = JSON .parse(myJSONtext, filter);
可選的 filter 參數(shù)將遍歷每一個value key 值對, 并進行相關(guān)的處理。如:
js 代碼
myData = JSON .parse(text, function (key, value) {
return key.indexOf('date') >= 0 ? new Date(value) : value; });
stringifier 函數(shù)的作用跟 parse 相反, 用來將一個js對象轉(zhuǎn)換為 JSON 文本。
js 代碼
var myJSONText = JSON .stringifier(myObject);
]]>
主站蜘蛛池模板:
霍林郭勒市 |
桂林市 |
河津市 |
吉隆县 |
祁阳县 |
新巴尔虎右旗 |
印江 |
武威市 |
皮山县 |
灌阳县 |
方山县 |
永靖县 |
黄山市 |
神池县 |
崇左市 |
濮阳市 |
黔南 |
孟州市 |
平塘县 |
泗水县 |
交城县 |
仙桃市 |
阿克 |
辽阳市 |
新干县 |
利川市 |
盐源县 |
西乌珠穆沁旗 |
泸定县 |
达孜县 |
育儿 |
江华 |
尚志市 |
旌德县 |
博白县 |
霞浦县 |
泰安市 |
龙井市 |
怀安县 |
华阴市 |
石首市 |