Library of mathematical functions (lua)

  • math.abs          — take the absolute value        like: math.abs(-5)  = 5
  • math.ceil          — up          like: math.ceil(4.3) = 5
  • math.floor        — down         like: math.floor(5.8) = 5
  • math.random         — take a random number         like: math.random(100)
  • math.randomseed        — set random seeds          like: math.randomseed(os.time())
  • math.max         — get max number          like: math.max(3.5,5,-8,35) = 35
  • math.min          — get min number          like: math.min(3.5,5,-8,35) = -8
  • math.sqrt          —  √x       like: math.sqrt(4) = 2
  • math.pow          — X^y          like: math.pow(3,4) = 81
  • math.modf()       — Divide integers and decimals        like:math.modf(15.98)     15    0.98

  • math.pi        —          like: math.pi = 3.14159265358979323846
  • math.rad        — get radian(获取弧度)           like: math.rad(180) = 3.14159265358
  • math.deg       —  get angle (获取角度)                      like: math.deg(math.pi) = 180
  • math.sin         — get sin value              like: math.sin(math.rad(30)) = 0.5
  • math.cos       — get cos value           like: math.cos(0.5) = 0.87758256
  • math.tan        — get tan value            like: math.tan(0.5) = 0.5463024

Basic use of SVN (1.3.9)

About TortoiseSVN (svn)

Online documentation(Chinese, simplified)

The command for Mac OS:

  • svn help (?, h)         // you can enter “svn help” or “svn ?” or “svn h” in terminal to get some help
  • svn add path
  • svn add *.suffix       //Add a file with the specified suffix       like:svn add * .py
  • svn add . –no-ignore –force     // Add all the files in the current directory
  • svn update(up)
  • svn checkout(co) path
  • svn commit -m “message note” ./         //commit files in the current directory
  • svn cleanup
  • svn status        //view file status  in the current directory

How to use the Terminal in macOS ?

  • cd ~     // navigate to your Home folder
  • cd ../     //navigate to the previous folder
  • cd    path       // you can drag the Documents folder onto the Terminal window.
  • ls           //is the command for listing files
  • pwd     //view current path
  • mkdir foldername    //create a folder under the current path     like:mkdir test
  • touch filename      //create a file        like:touch readme.txt
  • open path
  • clear         // clear all content on the current window
  • du -sh *       //view the folder size

Continue reading “How to use the Terminal in macOS ?”

The use of mysql

The use of mysql ( mysql version:5.6.34 )

  • mysql -uusername -ppassword      //logon mysql           like:mysql -uroot -pmiPG2e8
  • create database databasename;      //create database     like:create database test;
  • show databases;     //view all databases
  • use databasename;     //change to current database     like:use test;
  • drop database databasename;     //delete database     like:drop database test;
  • show tables;     //view all tables in the current database
  • create table tablename (columnname datatype );      //create table    like:create table test(
    id int unsigned not null auto_increment primary key,
    name char(8) not null,
    sex char(4) not null,
    age tinyint unsigned not null,
    tel char(13) null default “-“);
  • drop table tablename ;      //delete table       like:drop table test;
  • alter table oldtablename rename newtablename ;    // rename table    like: alter table test rename test1;
  • desc tablename;        //view table info       like:desc test;
  • show full fields from tablename;    //show table detail
  • truncate table tablename;     //clear all data in the table    like:truncate table test;
  • select * from tablename where …;    //query all data in the table    like:select * from users where userId = ‘1’;
  • insert into tablename (columnname) values (‘value’) where … ;  //insert      like:insert into users (username,password) values (‘Jerry’,’12345678′) where userId =’1′;
  • update tablename set columnname = ‘value’ where … ;     //update     like:update users set username = ‘Jack’ where userId = ‘1’;
  • delete from tablename where … ;       //delete     like:delete from users where userId = ‘1’;

  • select version();     //view mysql version(In the login state)
  • show character set;         //show all character set for mysql
  • exit;      //exit mysql