Time of Update: 2015-04-22
標籤:分頁查詢通過JDBC實現分頁查詢的方法有很多種,而且不同的資料庫機制也提供了不同的分頁方式,在這裡介紹兩種非常典型的分頁方法。通過ResultSet的游標實現分頁 通過ResultSet的游標實現分頁,優點是在各種資料庫上通用,缺點是佔用大量資源,不適合資料量大的情況。 2. 通過資料庫機制進行分頁 很多資料庫自身都提供了分頁機制,如SQL
Time of Update: 2015-04-25
標籤: 1 package sorting; 2 3 /** 4 * 選擇排序 5 * 平均O(n^2),最好O(n^2),最壞O(n^2);空間複雜度O(1);不穩定;簡單 6 * @author zeng 7 * 8 */ 9 public class XuanzePaixu {10 11 public static int[] xuanzepaixu(int[] a){12 int i,j,n=a.length;13 int tmp;14
Time of Update: 2015-04-24
標籤:BlockingQueue是一個介面,也是Queue的子介面。BlockingQueue具有一個特徵:當生產者線程試圖向BlockingQueue中放入元素時,如果該隊列已滿,則線程被阻塞;但消費者線程試圖從BlockingQueue中取出元素時,如果隊列已空,則該線程阻塞。程式的兩個線程通過交替向BlockingQueue中放入元素、取出元素,即可很好地控制線程的通訊。BlockingQueue提供如下兩個支援阻塞的方法:put(E e):嘗試把Eu元素放如BlockingQueue中,
Time of Update: 2015-04-24
標籤:如果程式不使用synchronized關鍵字來保證同步時,而是直接使用Lock對象來保證同步,則系統中不存在隱式的同步監視器,也就不能使用wait()、notify()、notifyAll()方法進行通訊了。當使用Lock對象來保證同步時,java提供了一個Condition類來保持協調,使用Condition可以讓哪些已經得到的Lock對象卻無法繼續執行的線程釋放Lock對象,Condition對象也可以喚醒其他處於等待的線程。Condition將同步監視器方法(wait()、notif
Time of Update: 2015-04-24
標籤:citrix netscaler vpx在通過ie登入時java的設定NetScaler在通過IE登入時JAVA的設定相信很多人在初次部署的時候都會遇到Java安全屬性設定限制的困擾,下面看一下如何去設定java的安全設定控制台裡開啟java屬性面板,三張圖解決java的設定650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/6B/EA/wKioL1U6GDKT3s0lAAF7iRIE58E576.jpg"
Time of Update: 2015-04-24
標籤:比如 Date currentTime ="2011-06-20 9:23:50"; Date endTime="2011-06-21 10:33:56"; 要求的結果是 endTime - currentTime = 還剩餘1天1小時10分6秒;如何來實現這個功能??import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.Date;public class MainActivity {
Time of Update: 2015-04-23
標籤: "=="操作符的作用1、用於基礎資料型別 (Elementary Data Type)的比較2、判斷引用是否指向堆記憶體的同一塊地址。equals所在位置:在Object類當中,而Object是所有類的父類,包含在jdk裡面,但並不適合絕大多數情境,通常需要重寫public boolean equals(Object obj) { return (this == obj);
Time of Update: 2015-04-23
標籤:package other;import java.security.MessageDigest;import java.security.NoSuchAlgorithmException;/* * MD5 演算法*/public class MD5 { // 全域數組 private final static String[] strDigits = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "
Time of Update: 2015-04-24
標籤:圖片 pdf pdf轉圖片 java 代碼:/** * 將pdf中的maxPage頁,轉換成一張圖片 * * @param pdfFile * pdf的路徑 * @param outpath * 輸出的圖片的路徑[包括名稱] * @param maxPage * pdf的頁數 *
Time of Update: 2015-04-22
標籤:主要使用到的Java類有:javax.xml.bind.JAXBContext,javax.xml.bind.Marshaller(編排) 代碼主要展示如下: public class Student { private int id; private String name; private int age; public int getId() { return id; } public void setId(int id)
Time of Update: 2015-04-22
標籤:由於線程的特性,當我們啟動了線程是沒有辦法用try catch捕獲異常的,如下例: 1 package com.xt.thinks21_2; 2 3 import java.util.concurrent.ExecutorService; 4 import java.util.concurrent.Executors; 5 6 /** 7 * 線程異常捕獲測試 8 * 9 * @author xue10 *11 */12 public class
Time of Update: 2015-04-22
標籤: 1.Hello World public class Hello { public static void main(String[] args)
Time of Update: 2015-04-22
標籤: 原來學過socket編程,因為最近我也在做自己的伺服器,但是沒有加任何安全機制,我就想到了這個伺服器可以承受的最大並發量是多少,當然這是和伺服器的記憶體有關的。
Time of Update: 2015-04-21
標籤:效能最佳化 效能 web伺服器 最佳化 效能概述
Time of Update: 2015-04-21
標籤:If you want the references initialized,you can do it: 1.At the point the objects are defined.This means that they‘ll always be initialized before the constructor is called 2.In the constructor for the class 3.Right before you actually need to
Time of Update: 2015-04-22
標籤: 1 package com.xt.thinks21_2; 2 3 import java.util.concurrent.ExecutorService; 4 import java.util.concurrent.Executors; 5 import java.util.concurrent.SynchronousQueue; 6 import java.util.concurrent.ThreadFactory; 7 import
Time of Update: 2015-04-21
標籤:synchronized最近用到線程同步,思路有點不是很清晰了,只記得synchronized和lock,其區別什麼的記不清了。抽點空進行一下總結:lock介面
Time of Update: 2015-04-22
標籤:hashcode java equals hash 一、什麼情況下需要重寫equals和hashcode()兩個方法?1、加入到hashset中的自訂類的對象,為確保他們不重複,需要對他們的類重寫equals()和hashcode()的方法。如果不重寫equals,相同內容不同引用的對象會被當做不同的對象被加入到hashset中。 重寫equal
Time of Update: 2015-04-21
標籤:java 壓縮 ant apache file 如果在Java要壓縮一個檔案夾及其所有子檔案與子檔案夾,可以利用到Apache公司提供的ant外掛程式。其實也就是一個jar包。比如,如果要把f:\bb下的所有檔案,壓縮成一個f:\bb.zip,如:首先先到Apache的官網,下載ant外掛程式,地址:http://ant.
Time of Update: 2015-04-21
標籤:Create a simple class. Inside a second class, define a reference to an object of the first class. Use lazy initialization to instantiate this object. 1 import static org.greggordon.tools.Print.*; 2 3 class Engine { 4 private String s; 5