2007年7月23日 #
Archetype | Command |
---|---|
JSF Basic | mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-jsf -DremoteRepositories=http://static.appfuse.org/releases![]() |
Spring MVC Basic | mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring -DremoteRepositories=http://static.appfuse.org/releases![]() |
Struts 2 Basic | mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/releases![]() |
Tapestry Basic | mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-tapestry -DremoteRepositories=http://static.appfuse.org/releases![]() |
JSF Modular | mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-modular-jsf -DremoteRepositories=http://static.appfuse.org/releases![]() |
Spring MVC Modular | mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-modular-spring -DremoteRepositories=http://static.appfuse.org/releases![]() |
Struts 2 Modular | mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-modular-struts -DremoteRepositories=http://static.appfuse.org/releases![]() |
Tapestry Modular | mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-modular-tapestry -DremoteRepositories=http://static.appfuse.org/releases![]() |
Core
(backend only) |
mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-core -DremoteRepositories=http://static.appfuse.org/releases![]() |
You should be able to run AppFuse immediately if you have a MySQL 5.x database installed and it's accessible to root using no password. If you'd prefer to use an embedded database, we've recently added Database Profiles for H2, HSQLDB, etc.
![]() |
MySQL Security
Running MySQL using root with no password is not the most secure thing to do. Once your database is created, you can change the root password using the command below: mysql --user=root --pass='' mysql -e "update user set password=password('newpw') where user='root'; flush privileges;" AppFuse uses the username "root" and a blank password by default. To change these values, modify the <jdbc.username> and <jdbc.password> properties in your project's pom.xml (at the bottom). |
Run your application
Running AppFuse is easy now. Once the archetype project is created, Maven will create and populate your database using the hibernate3 and dbunit
plugins, respectively. All you have to do is use Maven to run the Jetty container and view your application.
- Check your new project into source control, unless you have a good reason not to. Google Code
has free Subversion hosting, as do many others.
- From the command line, cd into your new project's directory and run mvn to download JARs, Tomcat and run the integration tests in your project. Now is a good time to take a coffee break or grab a beer - downloading everything and running the tests can take 5-10 minutes.
- To view your application run mvn jetty:run-war from your project's directory (for a modular project, you'll need to run mvn jetty:run-war from your project's web directory). Maven will start Jetty and you should be able to view your application in your browser at http://localhost:8080
.
The default username/password for an admin user is admin/admin. For a regular user, use user/user. - To override files from AppFuse, run mvn war:inplace. This will extract the dependent WARs into src/main/webapp, where you can change files to your heart's content. When you have the war expanded in your source tree, you can run mvn jetty:run. This will allow you to change files on-the-fly and Jetty will reload them as needed. The only problem with this approach is you end up with an "exploded AppFuse" in your project, which won't bode well for upgrading. We recommend you check your project into source control before running mvn war:inplace. That way, it'll be easier for you to decide what needs to be checked in (over written) and what can be deleted.
If you receive OutOfMemory errors when using mvn jetty:run, see this mailing list thread.
You can change AppFuse from its "embedded mode" to full-source mode by running mvn appfuse:full-source from your project's root directory.
![]() |
Bug with Ant 1.7.0
Local repositories and projects on Windows platforms are held in directories whose paths contain no spaces. To fix this issue, modify your $M2_HOME/conf/settings.xml and change your localRepository to something like the following: <localRepository>c:\docume~1\username\.m2\repository</localRepository> |
![]() |
Development Environment
See development environment for detailed instructions on how to setup your computer to develop AppFuse-based applications. |
![]() |
Changing database settings
To change your MySQL database settings, simply change the <jdbc.*> properties at the bottom of your pom.xml. See Database Profiles to use a database other than MySQL |
set MAVEN_OPTS=-Xmx512m -Xms512m -XX:MaxPermSize=512m
原因:?? url中有些字符被轉(zhuǎn)義,比如空格被編碼成加號(hào),于是傳的參數(shù)明明是加號(hào),獲取的值卻成了空格。如何解決呢?如果是通過url傳遞參數(shù),應(yīng)該對(duì)其進(jìn)行必要的編碼。
解決辦法:
???????? 在javascript中加入?? function URLencode(sStr)
{
??? return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2F');
}
對(duì)字符串進(jìn)行處理.如:var str=URLencode("abc+")
SD Relevant Steps:
1.Check if all delivery in due list have been processedVL06G (Could set background jobs to automatically generate the billing due list for posting)
2.Check if all picking in due list have been processedVL06P
3.Check if all goods issue in due list have been processedVL04
4.Check if all billed AR has been release to accountingVFX3
PP Relevant Steps:
1.Check if all back flash error has been solved (COGI Check every day this kind of problem and solved on time)
2.Check if all production orders that will not be followed have been finally??confirmed or technically closed. Do final confirmation even small quantity??variance exist but we consider this order has finished
3.Do technical close at month end for the orders will not be followed in the future
4.Confirmation. Do not confirm any assembly scrap when do production order conf.
MM Relevant Steps
1.Check if all goods movement has been booked in SAP
2.GR/IR clearing accounts maintenance if needed
3.Open the MM period for movement posting when new period starts MMPV
FI Relevant Steps
1.Book all accounting entries for:
- Accrued expense
- Do recurring entry (prepayment, accrued expense, amortization)
- Process G/L, vendor, customer balance & open items
- Cost allocations by FI
2.AM Fixed asset depreciation run and period postingAFAB
3.AM Periodic posting ASKB
4.G/L,AR,AP balance check & Open item clearing
5.Foreign currency revaluation for bank/cash & AR AP open items
Bank/cash revaluation: F.06
AR AP open items: F.05
6.GR/IR clearing account regrouping process F.19
7.Automatic clearing for G/L accounts, vendor and customer F.13
CO Relevant Steps
1.Release standard cost estimate
CK24Only when there are costing run to be released.
2.Cost reallocation according to activity
Distribution: CKV5
Assessment: KSU5
3.Cost splitting among activity KSS2
4.Actual activity price calculation KSII
5.Production order revaluation with actual activity price CON2
6.WIP calculationfor the production orders KKAO
7.Variance calculation for the production orders KKS1
8.Production / Costing orders settlement CO88/KO88
9.Material ledger closing > MMPV first
a.Create costing runCKRU00
b.Allow settlementCKMF_RUN
c.Allow closing entriesCKMG_RUN
d.Material selectionCKMB_RUN
e.Determine costing sequenceCKMC_RUN
f.Settle single levelCKMH_RUN
g.Settle multi levelCKMM_RUN
h.Post closingCKMI
所謂排序,就是要整理文件中的記錄,使之按關(guān)鍵字遞增(或遞減)次序排列起來。其確切定義如下:
輸入:n個(gè)記錄R1,R2,…,Rn,其相應(yīng)的關(guān)鍵字分別為K1,K2,…,Kn。
輸出:Ril,Ri2,…,Rin,使得Ki1≤Ki2≤…≤Kin。(或Ki1≥Ki2≥…≥Kin)。
??? 這里,我們簡(jiǎn)單介紹幾種排序方法,直接插入排序、希兒排序、冒泡排序、快速排序、直接選擇排序,文中所提及的代碼在IE6下測(cè)試通過。
直接插入排序基本思想
??? 假設(shè)待排序的記錄存放在數(shù)組R[1..n]中。初始時(shí),R[1]自成1個(gè)有序區(qū),無序區(qū)為R[2..n]。從i=2起直至i=n為止,依次將R[i]插入當(dāng)前的有序區(qū)R[1..i-1]中,生成含n個(gè)記錄的有序區(qū)。
??? 算法描述
??var?st?=?new?Date();
??var?temp,?j;
??for(var?i=1;?i<arr.length;?i++)?{
???if((arr[i])?<?(arr[i-1]))?{
????temp?=?arr[i];
????j?=?i-1;
????do?{
?????arr[j+1]?=?arr[j];
?????j--;
????}
????while?(j>-1?&&?(temp)?<?(arr[j]));
????arr[j+1]?=?temp;
???}//endif
??}
??status?=?(new?Date()?-?st)?+?'?ms';
??return?arr;
?}
希爾排序基本思想
??先取一個(gè)小于n的整數(shù)d1作為第一個(gè)增量,把文件的全部記錄分成d1個(gè)組。所有距離為dl的倍數(shù)的記錄放在同一個(gè)組中。先在各組內(nèi)進(jìn)行直接插人排序;然后,取第二個(gè)增量d2<d1重復(fù)上述的分組和排序,直至所取的增量dt=1(dt<dt-l<…<d2<d1),即所有記錄放在同一組中進(jìn)行直接插入排序?yàn)橹埂?br />? 該方法實(shí)質(zhì)上是一種分組插入方法。
??? 算法描述 ?
??var?st?=?new?Date();
??var?increment?=?arr.length;
??do?{
???increment?=?(increment/3|0)?+?1;
???arr?=?ShellPass(arr,?increment);
??}
??while?(increment?>?1)
??status?=?(new?Date()?-?st)?+?'?ms';
??return?arr;
?}
?function?ShellPass(arr,?d)?{?//希兒排序分段執(zhí)行函數(shù)
??var?temp,?j;
??for(var?i=d;?i<arr.length;?i++)?{
???if((arr[i])?<?(arr[i-d]))?{
????temp?=?arr[i];?j?=?i-d;
????do?{
?????arr[j+d]?=?arr[j];
?????j?=?j-d;
????}
????while?(j>-1?&&?(temp)?<?(arr[j]));
????arr[j+d]?=?temp;
???}//endif
??}
??return?arr;
?}
冒泡排序基本思想
???
將被排序的記錄數(shù)組R[1..n]垂直排列,每個(gè)記錄R[i]看作是重量為R[i].key的氣泡。根據(jù)輕氣泡不能在重氣泡之下的原則,從下往上掃描數(shù)組
R:凡掃描到違反本原則的輕氣泡,就使其向上"飄浮"。如此反復(fù)進(jìn)行,直到最后任何兩個(gè)氣泡都是輕者在上,重者在下為止。
??? 算法描述
?
??var?st?=?new?Date();
??var?temp;
??var?exchange;
??for(var?i=0;?i<arr.length;?i++)?{
???exchange?=?false;
???for(var?j=arr.length-2;?j>=i;?j--)?{
????if((arr[j+1])?<?(arr[j]))?{
?????temp?=?arr[j+1];
?????arr[j+1]?=?arr[j];
?????arr[j]?=?temp;
?????exchange?=?true;
????}
???}
???if(!exchange)?break;
??}
??status?=?(new?Date()?-?st)?+?'?ms';
??return?arr;
?}
快速排序基本思想
??? 將原問題分解為若干個(gè)規(guī)模更小但結(jié)構(gòu)與原問題相似的子問題。遞歸地解這些子問題,然后將這些子問題的解組合為原問題的解。
???
在R[low..high]中任選一個(gè)記錄作為基準(zhǔn)(Pivot),以此基準(zhǔn)將當(dāng)前無序區(qū)劃分為左、右兩個(gè)較小的子區(qū)間R[low..pivotpos-
1)和R[pivotpos+1..high],并使左邊子區(qū)間中所有記錄的關(guān)鍵字均小于等于基準(zhǔn)記錄(不妨記為pivot)的關(guān)鍵字
pivot.key,右邊的子區(qū)間中所有記錄的關(guān)鍵字均大于等于pivot.key,而基準(zhǔn)記錄pivot則位于正確的位置(pivotpos)上,它無
須參加后續(xù)的排序。
??? 算法描述
?
??if?(arguments.length>1)?{
???var?low?=?arguments[1];
???var?high?=?arguments[2];
??}?else?{
???var?low?=?0;
???var?high?=?arr.length-1;
??}
??if(low?<?high){
???//?function?Partition
???var?i?=?low;
???var?j?=?high;
???var?pivot?=?arr[i];
???while(i<j)?{
????while(i<j?&&?arr[j]>=pivot)
?????j--;
????if(i<j)
?????arr[i++]?=?arr[j];
????while(i<j?&&?arr[i]<=pivot)
?????i++;
????if(i<j)
?????arr[j--]?=?arr[i];
???}//endwhile
???arr[i]?=?pivot;
???//?end?function
???var?pivotpos?=?i;?//Partition(arr,low,high);
???QuickSort(arr,?low,?pivotpos-1);
???QuickSort(arr,?pivotpos+1,?high);
??}?else
???return;
???return?arr;
?}
直接選擇排序基本思想
?? n個(gè)記錄的文件的直接選擇排序可經(jīng)過n-1趟直接選擇排序得到有序結(jié)果:
?①初始狀態(tài):無序區(qū)為R[1..n],有序區(qū)為空。
?②第1趟排序
????在無序區(qū)R[1..n]中選出關(guān)鍵字最小的記錄R[k],將它與無序區(qū)的第1個(gè)記錄R[1]交換,使R[1..1]和R[2..n]分別變?yōu)橛涗泜€(gè)數(shù)增加1個(gè)的新有序區(qū)和記錄個(gè)數(shù)減少1個(gè)的新無序區(qū)。
……
?③第i趟排序
第i趟排序開始時(shí),當(dāng)前有序區(qū)和無序區(qū)分別為R[1..i-1]和R[i..n](1≤i≤n-1)。該趟排序從當(dāng)前無序區(qū)中選出關(guān)鍵字最小的記錄R?[k],將它與無序區(qū)的第1個(gè)記錄R[i]交換,使R[1..i]和R[i+1..n]分別變?yōu)橛涗泜€(gè)數(shù)增加1個(gè)的新有序區(qū)和記錄個(gè)數(shù)減少1個(gè)的新無序區(qū)。
????這樣,n個(gè)記錄的文件的直接選擇排序可經(jīng)過n-1趟直接選擇排序得到有序結(jié)果。
????算法描述
?function?SelectSort(arr)?{?//選擇排序->直接選擇排序
??var?st?=?new?Date();
??var?temp;
??for(var?i=0;?i<arr.length;?i++)?{
???var?k?=?i;
???for(var?j=i+1;?j<arr.length;?j++)?{
????if((arr[j])?<?(arr[k]))
?????k?=?j;
???}
???if?(k?!=?i){
????temp?=?arr[i];
????arr[i]?=?arr[k];
????arr[k]?=?temp;
???}
??}
??status?=?(new?Date()?-?st)?+?'?ms';
??return?arr;
?}
Dom + Javascript 在本機(jī)瀏覽器中對(duì)的表格數(shù)據(jù)進(jìn)行排序
在本機(jī)瀏覽器中對(duì)的表格數(shù)據(jù)進(jìn)行排序
在Web應(yīng)用中,數(shù)據(jù)從服務(wù)器端返回到客戶端,以表格形式表現(xiàn)出來。如果要對(duì)數(shù)據(jù)集按指定的列排序顯示,常規(guī)做法都是向服務(wù)器發(fā)出請(qǐng)求,服務(wù)器端程序重新從數(shù)據(jù)庫(kù)中取出按指定列排序的數(shù)據(jù),返回給客戶端,頁(yè)面重新顯示排序后數(shù)據(jù)。
?
采用這種方式有如下缺點(diǎn):
1- 響應(yīng)時(shí)間延遲,每次排序都要向服務(wù)器端發(fā)送請(qǐng)求,等待結(jié)果返回,同時(shí)增加網(wǎng)絡(luò)負(fù)載。
2- 編程復(fù)雜,可維護(hù)性差,而且客戶端和服務(wù)器端代碼耦合度很高,客戶端和服務(wù)器端都要處理排序涉及的列名、排序方式,如果有分頁(yè)和查詢條件,都需要在客戶端頁(yè)面中保留,排序請(qǐng)求時(shí)重新傳遞到服務(wù)器端,當(dāng)參數(shù)數(shù)量很多時(shí)極易出錯(cuò)。
3- 重用度很低,針對(duì)不同表格,很難抽象出一個(gè)公共程序來共用,需要逐個(gè)編寫代碼實(shí)現(xiàn),增加工作量。
?
現(xiàn)在換一個(gè)角度考慮,數(shù)據(jù)既然已下載到了客戶端,在重新排序時(shí)沒有必要再重服務(wù)器端獲取,只要對(duì)瀏覽器中的數(shù)據(jù)重新排序顯示就可以了。要實(shí)現(xiàn)該目標(biāo),需要做到以下幾點(diǎn):
1 - 獲得表格中要排序的數(shù)據(jù),將其放入一個(gè)2維數(shù)組中。
2 - 對(duì)2維數(shù)組排序。
3 - 用排序后的數(shù)據(jù)重新更新表格。
?
利用瀏覽器支持的DOM(Document Object Model)和JavaScript即可實(shí)現(xiàn)上述目標(biāo)。
?
通常頁(yè)面中會(huì)很多的<table>,要獲得需要排序數(shù)據(jù)所在的table,需要在<table>中增加一個(gè)id屬性,便于document對(duì)象用getElementById得到該表格對(duì)象,例如要排序的表格定義如下:
?<table id="st" >
??? <tr>
??????? <td>1</td>
??????? <td>2</td>
??? </tr>
</table>
?
在javascript中,用var objTable = document.getElementById("st")就可得到表格對(duì)象,該對(duì)象在DOM中定義為一個(gè)Element。
?
然
后用 var objRows =
objTable.getElementsByTagName("tr")得到該表格中全部的行對(duì)象,ObjRows.length返回該表格行數(shù);
var rowi =
objRows[i].getElementsByTagName("td")得到第i行的全部<td>節(jié)點(diǎn),i從0開始計(jì)數(shù),
rowi.item(j)則可得到第i行,第j列的節(jié)點(diǎn),該節(jié)點(diǎn)的innerHTML為該節(jié)點(diǎn)<td></td>之間的內(nèi)容。
?
獲取表格數(shù)據(jù)到2維數(shù)組的代碼見源代碼,此處略。
?
下面說明在javascript中2維數(shù)組的構(gòu)造和排序。
javascript不支持2維數(shù)組,因此需要用數(shù)組的數(shù)組來模擬一個(gè)2維數(shù)組,其方法是先定義一個(gè)1維數(shù)組,元素個(gè)數(shù)為2維數(shù)組的行數(shù),然后對(duì)每個(gè)元素賦一個(gè)值,值為一個(gè)數(shù)組,其元素個(gè)數(shù)為2維數(shù)組的列數(shù)。構(gòu)造代碼如下:
?
var rows = new Array(R);? //R為行數(shù)
for(var i = 0; i < rows.length; i++){
??? rows[i] = new Array(C);??? //C為列數(shù)
}
?
?
利用javascript中的Array.sort(comparer)對(duì)rows中的元素排序,比較方式由重新定義的比較函數(shù)得到。要根據(jù)第j列元素的大小排序,只要定義如下函數(shù)即可:
?
function compareCol(a,b){
???
??? if (a[j] < b[j])
??????? return -1;
?
??? if (a[j] > b[j])
??????? return 1;
?
?? return 0;
?
}
?
因?yàn)閏ompareCol只能有兩個(gè)參數(shù),因此j要定義為全局變量。
?
用rows.sort
(compareCol)就可實(shí)現(xiàn)根據(jù)j列值的大小對(duì)行進(jìn)行排序。根據(jù)javascript文檔,字符串比較大小是按照其Unicode編碼的大小來比
較,對(duì)英文排序沒有問題,對(duì)中文排序時(shí)就不是按通常的拼音排序,那需要javascript提供本地化支持,目前沒有發(fā)現(xiàn)javascript此功能。該
功能在java中可用java.text.Collator實(shí)現(xiàn)。
?
?
?以上介紹了在本地對(duì)瀏覽器中的數(shù)據(jù)進(jìn)行排序的主要思想,
為方便使用,將這些功能進(jìn)行了封裝,以javascript函數(shù)的提供,存放在sorttable.js文件中,在需要的頁(yè)面中用<script
type=text/javascript src='sorttable.js'></script>引入。
?
?
?下面說明排序函數(shù)原型和使用方法。
?
函數(shù)1 function sortTable(tableId,sortCol,compareType)
對(duì)頁(yè)面中指定表格中的數(shù)據(jù)進(jìn)行排序,通常第一行為標(biāo)題行,排序時(shí)從第二行開始,第一次調(diào)用為升序排列,第二次為降序排列,依次輪換。
tableId??? 為<table id=''>中id的值,在同一個(gè)頁(yè)面中要唯一。
sortCol??? 排序時(shí)用來比較大小的數(shù)據(jù)所在的列,從1開始計(jì)數(shù)。
compareType 排序時(shí)比較大小的方式,s-按字符串比較大小,n-按數(shù)字比較大小。
?
?
?
?函數(shù)2 function sortTableInRange(tableId,sortCol,compareType,startRow,endRow,startCol,endCol)
?
??????? 對(duì)表格中指定的區(qū)域數(shù)據(jù)排序,有時(shí)數(shù)據(jù)第一列為流水號(hào),最后一行為合計(jì),這些數(shù)據(jù)不需要參與排序,可用此函數(shù)來對(duì)部分?jǐn)?shù)據(jù)排序。
???????
??????? tableId??? 為<table id=''>中id的值,在同一個(gè)頁(yè)面中要唯一。
??????? sortCol??? 排序時(shí)用來比較大小的數(shù)據(jù)所在的列,從1開始計(jì)數(shù)。
??????? compareType 排序時(shí)比較大小的方式,s-按字符串比較大小,n-按數(shù)字比較大小。
??????? startRow,endRow 要排序區(qū)域開始和結(jié)束行號(hào),從1開始計(jì)數(shù)。例如對(duì)第2行到第7行排序,startRow=2,endRow=7
??????? startCol,endCol? 要排序區(qū)域開始和結(jié)束列號(hào),從1開始計(jì)數(shù)。
?
?
?
?
?
存在的問題:
1- 中文不能按拼音排序。
?
?
要注意的問題:
要排序的table必須用ID標(biāo)示,并要作為參數(shù)傳給排序函數(shù),表格中的數(shù)據(jù)應(yīng)該是可以排序的,否則結(jié)果不可預(yù)知;要排序的表格不能有嵌套表,否則排序出錯(cuò)。
?
?
本函數(shù)已在IE6.0 ,FireFox1.01中運(yùn)行通過。源代碼和例子代碼見后。
?
?
?
?
參考資料:
?
Danny Goodman with Michael Morrison?? JavaScript Bible 5th? ,John Wiley and Sons? 2004
?
David Flanagan? JavaScript The Definitive Guide 4th ,? O'Reilly? 2001
?
?
?
?
?
?附源代碼:要運(yùn)行例子,需要將javascript代碼保存到sorttable.js文件中,html部分代碼保存到同一目錄下另一文件中即可。
?
?
sorttable.js
?
?
?2??//
?3??//??在本機(jī)對(duì)瀏覽器頁(yè)面表格中的數(shù)據(jù)行進(jìn)行排序的javascript函數(shù)
?4??//?
?5??//??author?William??QQ:?22967225
?6?//??create?date?2005-12-2
?7??//??version?1.0
?8??//=========================================================
?9?
10??//column?index?for?sort
11??var?indexCol;
12??//比較函數(shù),用于Array.sort()排序時(shí)比較用。
13??//本函數(shù)比較數(shù)組元素array1[indexCol]和元素array2[indexCol]Unicode值的大小
14??function?arrayCompare(array1,array2){
15???//alert(array1.length+"--"+array1[indexCol]);
16???if?(array1[indexCol]?<?array2[indexCol])
17????return?-1;
18???if?(array1[indexCol]?>?array2[indexCol])
19????return?1;
20??
21???return?0;
22??
23??}
24??//比較數(shù)組元素array1[indexCol]和元素array2[indexCol]的數(shù)值大小
25??function?arrayCompareNumber(array1,array2){
26??
27???if?(parseInt(array1[indexCol])?<?parseInt(array2[indexCol]))
28????return?-1;
29???if?(parseInt(array1[indexCol])?>?parseInt(array2[indexCol]))
30????return?1;
31??
32???return?0;
33??}
34??//與arrayCompare相反方式比較大小,用于倒序使用
35??function?arrayCompareRev(array1,array2){
36??
37???if?(array1[indexCol]?<?array2[indexCol])
38????return?1;
39???if?(array1[indexCol]?>?array2[indexCol])
40????return?-1;
41??
42???return?0;
43??
44??}
45??//與arrayCompareNumber相反方式比較大小,用于倒序使用
46??function?arrayCompareNumberRev(array1,array2){
47???if?(parseInt(array1[indexCol])?<?parseInt(array2[indexCol]))
48????return?1;
49???if?(parseInt(array1[indexCol])?>?parseInt(array2[indexCol]))
50????return?-1;
51??
52???return?0;
53??}
54??
55??//define?a?2-dimension?array
56??function?BiArray(rows,cols){
57??
58???//simulate?multidimension?array
59???this.rows?=?rows;
60???this.cols?=?cols;
61??
62???//construct?array
63???var?lines?=?new?Array(rows);
64???for(var?i?=?0;i?<?lines.length;?i++){
65????lines[i]?=?new?Array(cols);
66???}
?