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). |
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.
![]() | The default username/password for an admin user is admin/admin. For a regular user, use user/user. |
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 |
聽聽聽 榪欓噷錛屾垜浠畝鍗曚粙緇嶅嚑縐嶆帓搴忔柟娉曪紝鐩存帴鎻掑叆鎺掑簭銆佸笇鍎挎帓搴忋佸啋娉℃帓搴忋佸揩閫熸帓搴忋佺洿鎺ラ夋嫨鎺掑簭錛屾枃涓墍鎻愬強鐨勪唬鐮佸湪IE6涓嬫祴璇曢氳繃銆?/p>
鐩存帴鎻掑叆鎺掑簭鍩烘湰鎬濇兂
聽聽聽 鍋囪寰呮帓搴忕殑璁板綍瀛樻斁鍦ㄦ暟緇凴[1..n]涓傚垵濮嬫椂錛孯[1]鑷垚1涓湁搴忓尯錛屾棤搴忓尯涓篟[2..n]銆備粠i=2璧風洿鑷砳=n涓烘錛屼緷嬈″皢R[i]鎻掑叆褰撳墠鐨勬湁搴忓尯R[1..i-1]涓紝鐢熸垚鍚玭涓褰曠殑鏈夊簭鍖恒?/p>
聽聽聽 綆楁硶鎻忚堪
聽聽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;
聽}
甯屽皵鎺掑簭鍩烘湰鎬濇兂
銆聽聽鍏堝彇涓涓皬浜巒鐨勬暣鏁癲1浣滀負絎竴涓閲忥紝鎶婃枃浠剁殑鍏ㄩ儴璁板綍鍒嗘垚d1涓粍銆傛墍鏈夎窛紱諱負dl鐨勫嶆暟鐨勮褰曟斁鍦ㄥ悓涓涓粍涓傚厛鍦ㄥ悇緇勫唴榪涜鐩存帴鎻掍漢鎺掑簭錛涚劧鍚庯紝鍙栫浜屼釜澧為噺d2<d1閲嶅涓婅堪鐨勫垎緇勫拰鎺掑簭錛岀洿鑷蟲墍鍙栫殑澧為噺dt=1(dt<dt-l<鈥?lt;d2<d1)錛屽嵆鎵鏈夎褰曟斁鍦ㄥ悓涓緇勪腑榪涜鐩存帴鎻掑叆鎺掑簭涓烘銆?br />聽 銆璇ユ柟娉曞疄璐ㄤ笂鏄竴縐嶅垎緇勬彃鍏ユ柟娉曘?/p>
聽聽聽 綆楁硶鎻忚堪 聽
聽聽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)聽{聽//甯屽効鎺掑簭鍒嗘鎵ц鍑芥暟
聽聽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;
聽}
鍐掓場鎺掑簭鍩烘湰鎬濇兂
聽聽聽
灝嗚鎺掑簭鐨勮褰曟暟緇凴[1..n]鍨傜洿鎺掑垪錛屾瘡涓褰昍[i]鐪嬩綔鏄噸閲忎負R[i].key鐨勬皵娉°傛牴鎹交姘旀場涓嶈兘鍦ㄩ噸姘旀場涔嬩笅鐨勫師鍒欙紝浠庝笅寰涓婃壂鎻忔暟緇?
R錛氬嚒鎵弿鍒拌繚鍙嶆湰鍘熷垯鐨勮交姘旀場錛屽氨浣垮叾鍚戜笂"椋樻誕"銆傚姝ゅ弽澶嶈繘琛岋紝鐩村埌鏈鍚庝換浣曚袱涓皵娉¢兘鏄交鑰呭湪涓婏紝閲嶈呭湪涓嬩負姝€?br />
聽聽聽 綆楁硶鎻忚堪
聽
聽聽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;
聽}
蹇熸帓搴忓熀鏈濇兂
聽聽聽 灝嗗師闂鍒嗚В涓鴻嫢騫蹭釜瑙勬ā鏇村皬浣嗙粨鏋勪笌鍘熼棶棰樼浉浼肩殑瀛愰棶棰樸傞掑綊鍦拌В榪欎簺瀛愰棶棰橈紝鐒跺悗灝嗚繖浜涘瓙闂鐨勮В緇勫悎涓哄師闂鐨勮В銆?br />聽聽聽
鍦≧[low..high]涓換閫変竴涓褰曚綔涓哄熀鍑?Pivot)錛屼互姝ゅ熀鍑嗗皢褰撳墠鏃犲簭鍖哄垝鍒嗕負宸︺佸彸涓や釜杈冨皬鐨勫瓙鍖洪棿R[low..pivotpos-
1)鍜孯[pivotpos+1..high]錛屽茍浣垮乏杈瑰瓙鍖洪棿涓墍鏈夎褰曠殑鍏抽敭瀛楀潎灝忎簬絳変簬鍩哄噯璁板綍(涓嶅Θ璁頒負pivot)鐨勫叧閿瓧
pivot.key錛屽彸杈圭殑瀛愬尯闂翠腑鎵鏈夎褰曠殑鍏抽敭瀛楀潎澶т簬絳変簬pivot.key錛岃屽熀鍑嗚褰昿ivot鍒欎綅浜庢紜殑浣嶇疆(pivotpos)涓婏紝瀹冩棤
欏誨弬鍔犲悗緇殑鎺掑簭銆?/p>
聽聽聽 綆楁硶鎻忚堪
聽
聽聽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錛宭ow錛宧igh);
聽聽聽QuickSort(arr,聽low,聽pivotpos-1);
聽聽聽QuickSort(arr,聽pivotpos+1,聽high);
聽聽}聽else
聽聽聽return;
聽聽聽return聽arr;
聽}
鐩存帴閫夋嫨鎺掑簭鍩烘湰鎬濇兂
聽聽銆n涓褰曠殑鏂囦歡鐨勭洿鎺ラ夋嫨鎺掑簭鍙粡榪噉-1瓚熺洿鎺ラ夋嫨鎺掑簭寰楀埌鏈夊簭緇撴灉錛?br />聽鈶犲垵濮嬬姸鎬侊細鏃犲簭鍖轟負R[1..n]錛屾湁搴忓尯涓虹┖銆?br />聽鈶$1瓚熸帓搴?br />聽聽聽聽鍦ㄦ棤搴忓尯R[1..n]涓夊嚭鍏抽敭瀛楁渶灝忕殑璁板綍R[k]錛屽皢瀹冧笌鏃犲簭鍖虹殑絎?涓褰昍[1]浜ゆ崲錛屼嬌R[1..1]鍜孯[2..n]鍒嗗埆鍙樹負璁板綍涓暟澧炲姞1涓殑鏂版湁搴忓尯鍜岃褰曚釜鏁板噺灝?涓殑鏂版棤搴忓尯銆?br />銆銆鈥︹?br />聽鈶㈢i瓚熸帓搴?br />銆銆絎琲瓚熸帓搴忓紑濮嬫椂錛屽綋鍓嶆湁搴忓尯鍜屾棤搴忓尯鍒嗗埆涓篟[1..i-1]鍜孯[i..n](1鈮鈮-1)銆傝瓚熸帓搴忎粠褰撳墠鏃犲簭鍖轟腑閫夊嚭鍏抽敭瀛楁渶灝忕殑璁板綍R聽[k]錛屽皢瀹冧笌鏃犲簭鍖虹殑絎?涓褰昍[i]浜ゆ崲錛屼嬌R[1..i]鍜孯[i+1..n]鍒嗗埆鍙樹負璁板綍涓暟澧炲姞1涓殑鏂版湁搴忓尯鍜岃褰曚釜鏁板噺灝?涓殑鏂版棤搴忓尯銆?br />聽聽聽聽榪欐牱錛宯涓褰曠殑鏂囦歡鐨勭洿鎺ラ夋嫨鎺掑簭鍙粡榪噉-1瓚熺洿鎺ラ夋嫨鎺掑簭寰楀埌鏈夊簭緇撴灉銆?br />
聽聽聽聽綆楁硶鎻忚堪
聽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;
聽}