2013年1月15日 星期二

Java Class Libraries - Company (Alvin API)

0

Java Class Libraries - Company # public class Person { private int age; private String firstName; private String lastName; private String nameString; private String ageString; public Person(String firstName, String lastName, int age) { this.age = age; this.firstName = firstName; this.lastName = lastName; } public void printName() { System.out.println(nameString); } public void printAge() { System.out.println(ageString); } public void printAgeGroup() { System.out.println(nameString); System.out.println(ageString); } } } } # public class Employee { private double currentSalary; private double newSalary; private java.lang.String name; public Employee() { name = "Last, First"; currentSalary = 0; } public Employee (String n) { name = n; } public String getName() { return name; } public...

2013年1月14日 星期一

Request Object In JSP

0

Methods of the request object is explained one by one as follows: request.getParameter(String name):This is the method, used for getting the value of the HTML form attribute. This method returns the string type value i.e. the value of the specified field of an HTML form. This method takes a string type parameter which is the name of the attribute of the html which value has to be retrieved through therequest object. request.getParameterNames():This is the method of the request object used for getting the enumeration of the attributes of the html form. These values are later retrieved through the java programming language by enumerating the retrieved enumerated data by the method of the request object. request.getParameterValues(String name):This is the method...

2013年1月10日 星期四

Mysql全文搜索(Fulltext Search)match against的使用方式 

0

Mysql全文搜索(Fulltext Search)match against的使用方式  全文檢索在MySQL 中就是一個FULLTEXT 類型索引。 FULLTEXT 索引用於MyISAM 表,可以在CREATE TABLE 時或之後使用ALTER TABLE 或CREATE INDEX 在CHAR、 VARCHAR 或TEXT 列上創建 對於大的數據庫,將數據裝載到一個沒有FULLTEXT 索引的表中,然後再使用ALTER TABLE (或CREATE INDEX) 創建索引,這將是非常快的。將數據裝載到一個已經有FULLTEXT 索引的表中,將是非常慢的。  1.使用Mysql全文檢索fulltext的先決條件 表的類型必須是MyISAM 建立全文檢索的字段類型必須是char,varchar,text 2.建立全文檢索先期配置 由於Mysql的默認配置是索引的詞的長度是4,所以要支持中文單字的話,首先更改這個. *Unix用戶要修改my.cnf,一般此文件在/etc/my.cnf,如果沒有找到,先查找一下find / -name 'my.cnf' 在 [mysqld] 位置內加入: ft_min_word_len = 2 其它屬性還有 ft_wordlist_charset = gbk ft_wordlist_file = /home/soft/mysql/share/mysql/wordlist-gbk.txt ft_stopword_file = /home/soft/mysql/share/mysql/stopwords-gbk.txt 稍微解釋一下: ft_wordlist_charset 表示詞典的字符集, 目前支持良好的有(UTF-8, gbk, gb2312, big5) ft_wordlist_file 是詞表文件,...

MySQL索引分析和優化

0

MySQL索引分析和優化 亞爾文提示:索引用來快速地尋找那些具有特定值的記錄,所有MySQL索引都以B-樹的形式保存。如果沒有索引,執行查詢時MySQL必須從第一個記錄開始掃描整個表的所有記錄,直至找到符合要求的記錄……    一、什麼是索引? 索引用來快速地尋找那些具有特定值的記錄,所有MySQL索引都以B-樹的形式保存。如果沒有索引,執行查詢時MySQL必須從第一個記錄開始掃描整個表的所有記錄,直至找到符合要求的記錄。表裡面的記錄數量越多,這個操作的代價就越高。如果作為搜索條件的列上已經創建了索引,MySQL無需掃描任何記錄即可迅速得到目標記錄所在的位置。如果表有1000個記錄,通過索引查找記錄至少要比順序掃描記錄快100倍。 假設我們創建了一個名為people的表: # CREATE TABLE people ( peopleid SMALLINT NOT NULL, name CHAR(50) NOT NULL ); 然後,我們完全隨機把1000個不同name值插入到people表。在數據文件中name 列沒有任何明確的次序。如果我們創建了name列的索引,MySQL將在索引中排序name列,對於索引中的每一項,MySQL在內部為它保存一個數據文件中實際記錄所在位置的“指針”。因此,如果我們要查找name等於“Mike”記錄的peopleid (SQL命令為“SELECT peopleid FROM people WHERE name='Mike';”),MySQL能夠在name的索引中查找“Mike”值,然後直接轉到數據文件中相應的行,準確地返回該行的peopleid(999)。在這個過程中,MySQL只需處理一個行就可以返回結果。如果沒有“name”列的索引,MySQL要掃描數據文件中的所有記錄,即1000個記錄!顯然,需要MySQL處理的記錄數量越少,則它完成任務的速度就越快。    二、索引的類型    MySQL提供多種索引類型供選擇:    普通索引...

Pages 14« 6789101112 »