DALLASCAO.COM

Site of Cao Shouguang, English to Chinese translator


Warning: Missing argument 1 for shapeshifter_archive_page_title(), called in /var/www/dallascao.com/en/wp-content/themes/shapeshifter/category.php on line 10 and defined in /var/www/dallascao.com/en/wp-content/themes/shapeshifter/includes/functions-do-actions.php on line 142

Category: World Wide Web

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

Excel VBA: move matching rows to another sheet

Excel VBA: move matching rows to another sheet
This VBA moves my paid jobs in my job list sheet (sheet1) to the sheet named “history” (sheet4). If the value of sixth column (Column F) of a row in sheet1 is “closed”, that row is then moved to the end of sheet4. Sub Button_Remove_Closed_Click() With Sheet1 ' For Each rw In .UsedRange.Rows ' ' […]Read More

The idea of mysqli prepare

The idea of mysqli prepare
Notice you do not need to prepare for each row insertion. $db = new mysqli('localhost', 'dbusername', 'dbpassword', 'dbname'); if ($db->connect_error >0) { die('Unable to connect to database [' . $db->connect_error . ']'); } $sql1 = connect_error >0) { die('Unable to connect to database [' . $db->connect_error . ']'); } $sql1 =Read More

Learn Java: initializer

Learn Java: initializer
public class SavingsAccount { public static void main(String[] args) { AccountCaculation myAccount = new AccountCaculation(1000).deposit(2000); AccountCaculation yourAccount = new AccountCaculation().deposit(5000); myAccount.printBalance(); yourAccount.printBalance(); System.out.println(AccountCaculation.totalBalance); System.out.println(AccountCaculation.usd2Rmb(myAccount.balance)); //Objects(instances) as array members AccountCaculation[] accountArray = new AccountCaculation[3]; for (int i=0; iRead More

static method

static method
public class SavingsAccount { public static void main(String[] args) { AccountCaculation myAccount = new AccountCaculation(1000).deposit(2000); AccountCaculation yourAccount = new AccountCaculation(2000).deposit(5000); myAccount.printBalance(); yourAccount.printBalance(); System.out.println(AccountCaculation.totalBalance); System.out.println(AccountCaculation.usd2Rmb(myAccount.balance)); } } class AccountCaculation { int balance; static int totalBalance; // static method is per class and cannot access object variables static int usd2Rmb (int usd) { //can access class variables […]Read More