DALLASCAO.COM

Site of Cao Shouguang, English to Chinese translator

Javascript: Always define var outside if

Javascript: Always define var outside if
if (true) {     const a="yes" } else {     const a="no" } console.log(a); //throw an error that a is not definedRead More

this in object method functions

this in object method functions
//three ways of writing a method function for an object const temp = {     name:"dallas",     method1:function(){         console.log(this.name); //dallas     },     method2() {         console.log(this.name); //dallas     },     method3:()=>{         console.log(this.name); //undefined     }   […]Read More

ES6: Let async functions return promise object

ES6: Let async functions return promise object
function myWait (){         return (() => {             return new Promise(function (resolve) {                 function Callback() {                     resolve("All right sparkly");                 }; […]Read More

Make Windows 10 Mail work with custom SMTPs

Make Windows 10 Mail work with custom SMTPs
I run my own mail server but I want to use smtp.sendgrid.net to send mails so I can see whether my mails are delivered and opened. Windows 10 Mail is a great app, except that it doesn’t work. Microsoft is stupid. It will create a program with critical bugs but will never correct it. Here […]Read More

Solving the “mysql: unknown variable ‘bind-address=0.0.0.0′” error

Solving the “mysql: unknown variable ‘bind-address=0.0.0.0′” error
Add “–no-defaults”  mysql --no-defaults -u[username] -p[password] [database] The mysql client and server both read my.cnf 🙁 mysql server is OK with bind-address, but the client doesn’t recognize it.Read More