發表文章

Angular中Router使用教學

圖片
Router 主要 Component   首先,在app.module.ts中加入Router module, 並建立Router規則,接著在@NgModule中加入routes 最後,在要使用Router的地方加入<router-outlet>,這裡我們在app.component.html中使用 接著,我們就可以使用<routerLink>變換<router-outlet>中的內容(對照前面routes<path, component>)

Mac + Home-brew + MySql 安裝

圖片
安裝: brew install mysql 啟動:brew services start mysql 設定:mysql_secure_installation 停止:brew services stop mysql 登入: mysql -u <username> -p

Java 自定義物件 排序 implements Comparable

定義物件 class Pair implements Comparable<Pair> { /* 自定義 object implements Comparable 42.07% */ int n ; int f ; public Pair ( int n , int f) { this . n = n ; this . f = f ; } public int compareTo (Pair o) { if ( this . f == o. f ) return o. n - this . n ; // desc return this . f - o. f ; // aces } }  之後排序可以使用 Collections. sort (l) ; 其中  List<Pair> l = new ArrayList<>() ;

Java 2d array sort(排序)

Arrays. sort (pairs , (a , b) -> { if (a[ 0 ] == b[ 0 ]) return a[ 1 ] - b[ 1 ] ; // if same strength, row aces else return a[ 0 ] - b[ 0 ] ; // normal, strength aces }) ;

Java 句號(.) split

 在java string 中如火想要正確的split 句號(.) 必須要使用 String.split("\\.") example: "leetcode.com".split("\\.");

MacOS + SDKMAN + JAVA

圖片
使用sdkman安裝多個不同版本的java 1. 安裝sdkman curl -s "https://get.sdkman.io" | bash 2. 顯示可安裝的java 版本 sdk  list java 3. 依照版本安裝 4. 切換java版本 5. java -version

Eclipse export WAR

  1. In Eclipse, stop Tomcat 2. Right-click your project and select Export > WAR File 3. In the Destination field, enter: <any-directory>/mycoolapp.war 4. Outside of Eclipse, start Tomcat - If you are using MS Windows, then you should find it on the Start menu 5. Make sure Tomcat is up and running by visiting: http://localhost:8080 6. Deploy your new WAR file by copying it to <tomcat-install-directory>\webapps Give it about 10-15 seconds to make the deployment. You'll know the deployment is over because you'll see a new folder created in webapps ... with your WAR file name. 7. Visit your new app. If your war file was: mycoolapp.war then you can access it with:  http://localhost:8080/mycoolapp/