2018-12-11

CsvToBean unable to get 1st column





Reference URL:
https://stackoverflow.com/questions/42328597/opencsv-populating-first-column-as-null


I met the same problem.

Solution

I saved the csv file again by utf-8 without BOM.
Then the first column is set with correct value.
No code needs to be changed.
I use the text editor named sakura.After choosing encoding as utf-8,a checkbox of BOM is enabled.Uncheck it and save the csv file.I think other editors have the same BOM option.

Reason

A BOM-ed UTF-8 string will start with the three following bytes. EF BB BF
The three bytes added to your csv file may changed your first column name.
  • Rather than link to existing questions you should raise a flag to mark this question as a duplicate of the one you believe answers it. – Neil Lunn May 31 '17 at 10:25


Ant builder from old environment hit issue after move to new IDE and new Machine(laptop)




Java Virtual Machine Launcher
A Java Exception has occurred.

Building workspace, Ant build





[eclipse-workspaces]\eclipse-jee-photon-R-win32-x86_64\.metadata\.log



!ENTRY org.eclipse.ant.launching 4 120 2018-12-11 14:46:39.726
!MESSAGE Error logged from Ant UI:
!STACK 0
java.net.SocketTimeoutException: Accept timed out
at java.net.DualStackPlainSocketImpl.waitForNewConnection(Native Method)
at java.net.DualStackPlainSocketImpl.socketAccept(Unknown Source)
at java.net.AbstractPlainSocketImpl.accept(Unknown Source)
at java.net.PlainSocketImpl.accept(Unknown Source)
at java.net.ServerSocket.implAccept(Unknown Source)
at java.net.ServerSocket.accept(Unknown Source)
at org.eclipse.ant.internal.launching.launchConfigurations.RemoteAntBuildListener$ServerConnection.run(RemoteAntBuildListener.java:89)










[Project Properties](Alt + Enter) > Builder

Select Ant Builder from the listing.
Edit
JRE
Separate JRE: Select JDK 1.8

































Windows 10 change login id




Solution
Reference URL:
https://www.groovypost.com/howto/change-account-name-windows-10/





Method 2: User Accounts Advanced Control Panel
There is another way you can do it. Press Windows key + R, type: netplwiz or control userpasswords2 then hit Enter. Select the account then click Properties


Select the General tab then enter the user name you want to use. Click Apply then OK, then click Apply then OK again to confirm the change.


2018-12-10

Spring controller submit chinese character into DB via JPA.






Web page chinese character to tomcat via Spring



Solved by solution below:
https://stackoverflow.com/questions/4318664/save-chinese-characters-with-spring-mvc-java





<filter>
    <filter-name>charsetFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
        <param-name>encoding</param-name>
        <param-value>UTF-8</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>charsetFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>






Tomcat Java to MySql

SHOW VARIABLES LIKE "%version%";


mysql> SHOW VARIABLES LIKE "%version%";
+-------------------------+------------------------------+
| Variable_name           | Value                        |
+-------------------------+------------------------------+
| innodb_version          | 5.7.23                       |
| protocol_version        | 10                           |
| slave_type_conversions  |                              |
| tls_version             | TLSv1,TLSv1.1                |
| version                 | 5.7.23                       |
| version_comment         | MySQL Community Server (GPL) |
| version_compile_machine | x86_64                       |
| version_compile_os      | Linux                        |
+-------------------------+------------------------------+
8 rows in set (0.00 sec)




Normally with this would be enough to solve the encoding

https://stackoverflow.com/questions/4782077/execute-mysql-query-contains-chinese-character-using-java-program

Try connecting with following switch
 String url = "jdbc:mysql://host/database?characterSetResults=UTF-8&characterEncoding=UTF-8&useUnicode=yes";




But I'm using JPA

https://stackoverflow.com/questions/18163328/jpa-utf-8-characters-not-persisted
Solved by solution below:
use the character encoding in the property of persistence.xml file
<property name="javax.persistence.jdbc.url" 
   value="jdbc:mysql://localhost:3306/blogdatabase?useUnicode=yes&amp;characterEncoding=UTF-8"/>































Google Referrals