【20170221】Recent summary

The recent summary of the long time no see, I think this series still has to be updated...

 

1) Windows mysql Chinese garbled problem.

After confirming that the Chinese encoding of the server is UTF-8 correct, you need to consider the encoding setting of mysql. Check it out with sql statement:

SHOW VARIABLES LIKE '%char%'

To ensure that character_set_server/system/server/results, etc. are all utf8, by default, character_set_server may be latain, the solution:

Find the installation path of mysql server, find MySQLInstanceConfig.exe in the bin directory, click all the way to the character encoding, select utf8, and then finish.



 Then restart the mysql service, execute the above sql statement again, and ensure that the result is as follows:



 Try again, you can find that the Chinese insert is normal.

 

2) Hibernate save Chinese field garbled

A question that has puzzled me for a long time has arisen before when saving fields with Hibernate. There is a "description" field. For simplicity, I use explain first, then desc. . But because they happen to be the keywords of mysql, an error is reported when the database is saved:

check the manual that corresponds to your MySQL server version for the right syntax to use near 'explain='æ–°å¢æˆ·å·¥ä½œæ—¥', general=2.0, invest_incr=2.0, is_new_customer=0, i' at line 1,

 

Caused by: java.sql.BatchUpdateException:

I feel very depressed, why the explain field is garbled, obviously there is no garbled code when debugging, I have been puzzled. . After changing it, the error never occurred again! Record it as a wake-up call!

 

3) Start the project under tomcat and report memory overflow

Double-click the tomcat server, open the open launch configuration in the interface, then switch to the Arguments tab, and add in VM arguments:

-Xms512M -Xmx1024M -XX:PermSize=256m -XX:MaxPermSize=512m

Restart and see.

 

4) js gets the project url

function getbaseUrl () {

   var location = document.location;

   return location.protocol+"//"+location.host+"/项目名";

   }

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326550776&siteId=291194637