2017年4月24日 星期一

Java NetBeans Glassfish設定MySQL JDBC

在NetBeans上,如果你直接在EJB專案上加入DataSourcePool基本上不會成功(至少我沒成功過...)
目前環境:NetBeans 8.2 + Glassfish 4.1
(別用Glassfish 4.1.1,那是個坑! 至少對我來說很坑)

首先要搞定Driver問題,第一步跑到MySQL官網去抓Driver
接著解壓縮之後把.jar檔copy到以下位置:
[glassfish_install_directory]/domains/domain-name/lib/ext/
然後到以下目錄位置:
[netbeans_install_directory]/ide/modules/ext/
找到mysql-connector-java-[version]-bin.jar
將名字複製起來,砍掉檔案,把你抓的jar檔copy進來,將名稱修改為原本的檔案名稱
以上,就是有關Driver的部分。

第二步驟,建立 JDBC Connection Pool / Resources
我懶得翻譯了,按照原文說的做理論上就沒問題了。
  • Go to your Glassfish server administration panel (Link should look like this: http://localhost:4848/common/index.jsf (Under Additional Properties tab)
    • Click on Services in Netbeans
    • Click on Server
    • Right-click on your server name [A pop-up contextual menu appears]
    • Click on View Domain Admin Console [Note: Your server must be running in order to see that feature. A browser tab is automatically launched, if the server is running. You know that your server is running if you see a greenish arrow pointing to the right on the right of the server instance]
  • Click on resources
  • Click on JDBC
  • Click on JDBC Connection Pools
  • Add the following properties by clicking every time on the button Add Property (After selecting the pool name and editing it):
    • driverClass: com.mysql.jdbc.Driver
    • URL : jdbc:mysql://localhost/your_database_name
    • password : your_password to the database management system
    • serverName : localhost or your_server_name
    • user : root or your_username to access the database management system
    • databaseName : your_database_name
  • Set up your JDBC Resources [jdbc/your_pool_name]
  • Point to the specific connection pool you just setup by selecting it in the drop down box.

參考資料:


2017年3月16日 星期四

IOS 如何讓production跟dev同時存在裝置上

並不是一套BundleID

首先,要說明的是沒有辦法透過同一個bundleID做到這件事情,只能用兩套bundle id來完成dev與product同時存在,然後透過Build-Setting去設定參數,讓build dev/store時採用不同的bundle id,如此就能讓兩套同時存在手機上了。

作法:

1. target-> build-setting -> + -> add User-Defined :
  new BUNDLE_ID
  new BUNDLE_NAME

2. target-> info :
  set Bundle name : $(BUNDLE_NAME)
  set Bundle id : $(BUNDLE_ID)


打完收工。

參考資料:
http://blog.xebia.com/run-your-ios-app-without-overwriting-the-app-store-version/