發表文章

目前顯示的是 2016的文章

java.lang.OutOfMemoryError: Java heap space type Exception report problem

java預設的heap space只有128mb,導致web服務產生錯誤。 解決方法(ubuntu): 新增 /usr/share/tomcat7/bin/setenv.sh檔案,內容視情況調整, 範例:JAVA_OPTS="-Xms256M -Xmx768M" chmod 755 setenv.sh 其他資料可以參考: /usr/share/tomcat7/bin/catalina.sh 2016/12/14補充 也可以修改此檔/etc/default/tomcat8 JAVA_OPTS="-Djava.awt.headless=true -Xms256m -Xmx768m -XX:+UseConcMarkSweepGC" reference How to fix out of memory errors by increasing available memory https://confluence.atlassian.com/confkb/how-to-fix-out-of-memory-errors-by-increasing-available-memory-154071.html Tomcat 產生OutOfMemoryError http://blog.xuite.net/keanuhome/blog/56035165-Tomcat+%E7%94%A2%E7%94%9FOutOfMemoryError

vmware fusion自訂network adapter的DHCP設定

vmware fusion自訂network adapter的DHCP設定 VMware Fusion 6.x Professional, Fusion 7.x Pro and Fusion 8.x Pro includes a network editor that can be used to make the required changes. To access the network editor:     Click VMware Fusion in the menu bar.     Click Preferences.     Click Network.     Click the + sign located at the bottom right to add a custom network connection. Reference Modifying the DHCP settings of vmnet1 and vmnet8 in Fusion (1026510) https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1026510

JavaMail透過Gmail寄信發生AuthenticationFailedException錯誤

狀況 JavaMail透過Gmail寄信發生AuthenticationFailedException錯誤 java產生的exception範例如下: javax.mail.AuthenticationFailedException: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbvL 534-5.7.14 534-5.7.14  Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14  Learn more at 534 5.7.14  https://support.google.com/mail/answer/78754 gmail也寄信警告通知: Someone just tried to sign in to your Google Account demo@demo.com from an app that doesn't meet modern security standards. 原因 因為Gmail已經改變安全政策建議使用OAuth2方式取得權限,所以JavaMail的登入方式被拒。 解決方法 至google網站修改權限,將Access for less secure apps設為開啟(Turn on) https://www.google.com/settings/security/lesssecureapps reference http://www.oracle.com/technetwork/java/javamail/faq-135477.html#gmailauth

google map api

Google Developers Console https://console.developers.google.com Maps JavaScript API - Geocoding Service https://developers.google.com/maps/documentation/javascript/geocoding Web services - Geocoding API https://developers.google.com/maps/documentation/geocoding/intro Google 地圖 Web 服務的用戶端程式庫 https://developers.google.com/maps/web-services/client-library Google Maps API地址轉換 http://blog.darkthread.net/post-2012-06-15-geocoding-api.aspx

google recaptcha

google recaptcha https://www.google.com/recaptcha/ doc https://developers.google.com/recaptcha/docs/start New reCaptcha with jQuery Validation Plugin http://stackoverflow.com/questions/29563822/new-recaptcha-with-jquery-validation-plugin How can I validate google reCAPTCHA v2 using javascript/jQuery? http://stackoverflow.com/questions/27902539/how-can-i-validate-google-recaptcha-v2-using-javascript-jquery

Spring framework接收html array element

接收某一個參數的array in html: <td><input type="text" name="priority" value="${Bean.priority}"></td> in spring controller: @RequestParam(value = "priority", required = true) String priority[] 接收多個參數的array,使用modelAttribute in html: <form:form method="post" action="save.html" modelAttribute="contactForm"> <td><input name="contacts[${status.index}].firstname" value="${contact.firstname}"/></td> in spring controller: @ModelAttribute("contactForm") ContactForm contactForm List<Contact> contacts = contactForm.getContacts(); Spring MVC: Multiple Row Form Submit using List of Beans http://viralpatel.net/blogs/spring-mvc-multi-row-submit-java-list/ <c:forEach varStatus="status">中 varStatus的属性简介 http://my.oschina.net/xsh1208/blog/179841

Ubuntu 14.04 mount AWS S3

debian ubuntu raspberri-pi moubt exfat

Step.1 Install exFAT Driver $ sudo apt-get install exfat-fuse Step.2 Mount USB Flash Disk $ mkdir /media/usbname $ sudo mount -t exfat -o rw /dev/sda2 /media/usbname umount: sudo umount usbname/  or sudo umount /dev/sda2 How to enable exFAT in Ubuntu http://apcmag.com/how-to-enable-exfat-in-ubuntu.htm/ Proper way of unmounting usb stick (drive) https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=53987 Raspberry Pi : Support exFAT USB Flash Disk https://yfc58.wordpress.com/2013/05/23/raspberry-pi-support-exfat-usb-flash-disk/

Ubuntu 14.04英文版安裝中文輸入法

安裝中文輸入法之前,須先安裝desktop的中文語系。 System-Settings - Language Support - Install/Remove Languages - 選擇Chinese(traditional) 完成後,安裝gcin輸入法。 在Ubuntu Software Center安裝gcin,回 Language Support設定Keyboard input method system為gcin,接著重新登入帳號生效。 參考資料 Ubuntu 14.04安裝鍵盤輸入法系統gcin http://blog.xuite.net/yh96301/blog/287374341

java servlet HttpServletRequest參數

String scheme = req . getScheme (); // http String serverName = req . getServerName (); // hostname.com int serverPort = req . getServerPort (); // 80 String contextPath = req . getContextPath (); // /mywebapp String servletPath = req . getServletPath (); // /servlet/MyServlet String pathInfo = req . getPathInfo (); // /a/b/c String queryString = req . getQueryString (); // d=parameter req.getServletContext().getRealPath("")) disk path: /home/ubuntu/...   req.getServletContext().getRealPath("/WEB-INF/abc.properties")) disk path: /home/ubuntu/... /WEB-INF/abc.properties   request.getServletPath= /test request.getRequestDispatcher= null request.getDispatcherType= REQUEST request.getServletContext().getContextPath()= /project request.getServletContext().getServletContextName()= Spring MVC Application request.getServletContext().getContext= null request.getServletContext().getServletNames()= java

Firefox不會儲存密碼的問題

Firefox不會儲存密碼的問題,原因是將該網站設定為不儲存密碼,所以去修改那個清單就可以了。 Usernames and passwords are not saved Firefox密碼管理員 Password Manager - Remember, delete, change and import saved passwords in Firefox