Monthly Archives: August 2020

Make TinyMCE Disable or Readonly

Javascript

Reference:

  1. https://stackoverflow.com/questions/13881812/make-readonly-disable-tinymce-textarea

TinyMce Get Instance

Javascript

HTML

Reference:

  1. https://stackoverflow.com/questions/36383626/how-do-i-get-tinymce-editor-instance-by-the-element-selector/36386886

AES Decrypt

AES/CBC/PKCS5Padding encryption

  1. MD5 Digest the password(REST_API_KEY) using SHA-256
  2. iv parameter is empty
  3. Decrypt the encrypted contents using AES/CBC/PKCS5Padding

Laravel verifycsrftoken except not working

Path issue

Example URL: http://localhost:8000/wingpay/listener

Reference:

  1. https://stackoverflow.com/questions/32751063/laravel-verifycsrftoken-exception-not-working

Javascript execute twice

iframe

 

SQL Statements to get daily Report

 

jQuery Datatable reload()

Example:

Reference:

  1. https://datatables.net/reference/api/ajax.reload()
  2. https://stackoverflow.com/questions/42905454/datatables-ajax-reload-loses-page

Transaction and lock tables in Laravel

Example

Reference:

  1. https://stackoverflow.com/questions/53522444/how-to-lock-table-with-laravel
  2. https://www.mysql.tw/2018/06/mysql-lock-table-lockrow-lock.html
  3. https://xyz.cinc.biz/2013/04/mysql-lock-tables.html
  4. https://laravel.com/docs/6.x/queries#pessimistic-locking

Laravel Storage Extension Issue

Script

Get correct MIME Type

Reference:

  1. https://laracasts.com/discuss/channels/requests/putfile-method-stores-mp3-files-as-bin-in-laravel?page=0
  2. https://laracasts.com/discuss/channels/laravel/laravel-54-uploadedfilegetmimetype-returns-incorrect-mimetype

Read CSV File

Don’t use phpspreadsheet to read .csv file because there could be some bugs and get incorrect result.

Reference:

  1. https://www.php.net/manual/zh/function.fgetcsv