Time of Update: 2018-12-03
IE緩衝問題詳解1、什麼是IE緩衝為了提高訪問網頁的速度,Internet Explorer瀏覽器會採用累積式加速的方法,將你曾經訪問的網頁內容(包括圖片以及cookie檔案等)存放在電腦裡。這個存放空間,我們就稱它為IE緩衝。以後我們每次訪問網站時,IE會首先搜尋這個目錄,如果其中已經有訪問過的內容,那IE就不必從網上下載,而直接從緩衝中調出來,從而提高了訪問網站的速度。2、如何設定IE緩衝1)步驟如下:(IE8.0為例)工具—>Internet選項-->常規(一)圖一 2)
Time of Update: 2018-12-03
依賴注入,可以使Bean中的屬性通過Spring進行配置,從HelloWorld中可以看到,由Spring的XML設定檔決定了對象被建立時它的屬性是如何被初始化的。Spring設定檔中定義Bean同時就定義了它的屬性的值或引用的對象,HelloWorld中是通過Bean中的Setter方法實現的。算起來Spring中初始化類屬性值有兩種方法,第一種,使用Bean中的Setter方法,第二種使用類的構造方法進行初始化,Spring在設定檔中進行定義的時候同樣可以定義它的建構函式所需的參數。例如He
Time of Update: 2018-12-03
如果需要在Bean被建立以及銷毀時執行特定的初始化與清理操作在Spring中有兩種選擇。1.在XML中定義bean的init-method與destroy-method屬性 執行init與destroy方法非強制,在xml中自由配置,與Spring架構依賴度低2.使Bean實現初始化與銷毀操作介面InitializingBean與DisposableBean,如:public class Message implements InitializingBean ,
Time of Update: 2018-12-03
經典:統計字串中漢字,英文,數字,特殊符號個數package wzs.arithmetics;/** * 分別統計出其中字串中漢字,英文字母,數字,其他字元數量 * @author wWX154783 * */public class Test_wzs7{ public static void main(String[] args) { String str = "a12中國3@b&4語*言3c"; String E1 =
Time of Update: 2018-12-03
之前整理了靜態工廠與非靜態工廠類建立Bean的內容,今天學到了FactoryBean的使用。尋找了下資料關於factory就這三種常用的方法了,另外這記裡的FactoryBean與非靜態工廠類XML配置實現結果基本是一樣的,但是使用FactoryBean看起來更簡潔並且實現了型別安全。(Spring中有需要預置的FactoryBean,例如JndiObjectFactoryBean,LocalSessionFactoryBean) FactoryBean是一個介面,通過實現此介面來完成工廠類。F
Time of Update: 2018-12-03
// 硬幣找零 遞迴演算法public class Test_001{ // 硬幣的類型 private static int[] money = { 10, 5, 2, 1 }; // 每個硬幣對應的數量 private static int[] tote = new int[money.length]; public static void main(String[] args) { int myMoney
Time of Update: 2018-12-03
通過買基金來間接買股票獲得收入為例。package com.wzs.design;/** * 大話設計模式--page105 面板模式 * * @author Administrator * */public class AppearanceModel {public static void main(String[] args) {Fund fund = new Fund(new Stock1(), new Stock2(), new
Time of Update: 2018-12-03
//尋找數組中的最大值和最小值public class Test{ // 需要尋找的數組 static int[] arr = { 9, 5, 1, 8, 2, 3, 4, 6, 7 }; // 數組的長度 static int maxIndex = arr.length - 1; public static void main(String[] args) { // find1(arr); //
Time of Update: 2018-12-03
以繪製小人為例子。package com.wzs.design;/** * 大話設計模式--page116 建造者模式 * * @author Administrator * */public class BuilderPattern {public static void main(String[] args) {PersonDirector personThinDirector = new PersonDirector(new PersonThinBuilder());//
Time of Update: 2018-12-03
做整合工作時使用到了第三方公司提供的介面JAR包,在本地TOMCAT測試通過後部署到WEBLOGIC上。拋出了weblogic.net.http.SOAPHttpsURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection這樣的錯誤。這段是第三方公司JAR包中代碼拋出的異常。溝通得知第三方公司jar包中存在類似如下的代碼:HttpsURLConnection conn =
Time of Update: 2018-12-03
在Bean被建立時Bean的屬性(property)如果在設定檔Bean的定義中沒有進行初始化賦值,預設情況下Spring對於沒有進行初始化的屬性(property)是不做檢查的。但是很多情況下會要求Bean特定的屬性必須進行初始化賦值,在Spring2.x中通過在bean標籤中使用dependency-check屬性設定由Spring進行強制檢查的方式。denpendency-check屬性有四個值 <bean id="ernie" class="com.***."
Time of Update: 2018-12-03
以一種方法的兩種資料庫實現為例子.第一種:抽象工廠package com.wzs.three;/** * 大話設計模式--page128 抽象工廠 * * @author Administrator * */public class AbstractFactory {public static void main(String[] args) {// IFactory factory = new SqlServerFactory();IFactory factory = new
Time of Update: 2018-12-03
/** * list類型有序的儲存 * @author wWX154783 */public class LimitStorageList{ private long maxTopN;// topN最大值 private List<KeyCountPair> topNList;// 儲存topN的list public LimitStorageList() { } public LimitStorageList(long maxTopN,
Time of Update: 2018-12-03
Spring在配置過程中可以實現Bean的參考型別屬性與其他已定義好的Bean的自動關聯,除了可以減少手工輸入外,還可以實現應用的動態構建。不過大多數時候需要整個應用遵循特定的開發規則與命名規則,否則很容易造成程式難於理解與混亂。很多人更願意多做點工作也不願意造成代碼調試的困難。如果要實現自動關聯,很簡單,XML配置方式只需要在Bean標籤中加入autowire屬性即可。而且這種關聯不僅僅限制與Bean的屬性,對於Bean的構造方法的參數也可以實現自動關聯。以下是用來樣本的兩個類,Message
Time of Update: 2018-12-03
只是寫了按照對象裡面的id排序,如果按照其餘的欄位升降序也可以實現。/** * 個人資訊排序 * @author wWX154783 * */public class PersonSort{ public static void main(String[] args) { List<Person> list = new ArrayList<Person>(); for (int i = 0; i < 10; i++)
Time of Update: 2018-12-03
測試 str.isEmpty()和 "".equals(str)兩種判斷的效率比較次數999999999str.isEmpty()用時2735(2.7秒)"".equals(str)用時10516(10秒)差別如此之大public class Test4{ public static void main(String[] args) { long times = 999999999; String str = ""; long a1 =
Time of Update: 2018-12-03
以複製簡曆為例子.package com.wzs.design;/** * 大話設計模式--page88 原型模式 * * @author Administrator * */public class PrototypePattern {public static void main(String[] args) throws CloneNotSupportedException {WorkExperience workExperience = new WorkExperience("201
Time of Update: 2018-12-03
普通定義Bean並且進行初始化的方法一般通過property(屬性)的setter方法或者構造方法進行。例如<bean id="beanName" class="com.csdn.net.arvin.BeanClass" > <constructor-arg value="***" /> <property name="propertyOne" value="" /></bean>這種定義建立Bean相當於使用new
Time of Update: 2018-12-03
以學生做試卷為例。package com.wzs.design;/** * 大話設計模式--page93 模板方法模式 * * @author Administrator * */public class TemplateMethod {public static void main(String[] args) {TestPaperA testPaperA = new
Time of Update: 2018-12-03
使用@Autowired標註來進行porperty與Bean的auto-wiring。準備首先要使用@Autowired需要在spring-config.xml 中增加配置,一般有兩種方式:1.在設定檔中增加context命名空間定義,並添加<context:annotation-config /> 標籤配置。完整代碼:<?xml version="1.0" encoding="UTF-8"?><beans