March 16
LAA Framework - add a form
Create form html, and give a form name (which will be handled by controller when form is submitted)
<form class="new-form" method="post" action="">
<input type="hidden" name="form_name" value="my_form_name">
<!-- form contents -->
<div class="form-group">
<label>Airway Bill Nubmer:</label>
...
March 11
MySql correct font display issue with asian font from DB by using UTF-8
Use set_charset to turn current charset to utf8, and you will be able to display Asian fonts.
$db_link = mysqli_connect($db['host'],$db['user'],$db['pass'],$db['db']);
// echo "Initial character set is: " . $db_link -> character_set_name();
$db_link -> set_charset("utf8"); // Change character set to utf8
// echo "Current character set is: " . $db_link -> character_set_name();
...
March 6
LAA Framework - add css file in controller
Attach a css file to a controller that applies to:
1. single url : add to target Action function in the selected Controoler.
$this->add_css_files[] = '/laa_mvc/modules/{ModuleName}/themes/{addedCssFileName}.css'
or,
2. apply to entire controller: add your css file to__contruct() function in the controller class.
function __construct($params) {
parent::__construct($params);
$this->add_css_files[] = '/laa_mvc/modules/{ModuleName}/themes/{addedCssFileName}.css';
return $this;
}
...
March 2
Copying Files Between Local Computer and Instance (AWS)
To copy files between your computer and your instance you can use an FTP service like FileZilla or the command scp which stands for secure copy.
To use scp with a key pair use the following command:
$ scp -i path/to/key file/to/copy user@ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com:path/to/file
To use it without a key pair, just omit the flag -i and type in the password of the user...
February 27
Free Wildcard SSL Certificate From Let's Encrypt with certbot
Instruction is from certbot.eff.org with actual testing note.
1. Add Certbot PPA
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
2. Install Certbot
sudo apt-get install certbot python-certbot-apache
3. get and install your certs
sudo certbot --apache
or, just get a certificate
sudo certbot certonly --apache
4. test automatic renewal
sudo certbot renew --dry-run
For wildcard, you should run acme-v02 for wildcard domains.
$ sudo certbot certonly --manual...
February 26
Upgrade Ubuntu 16.04 to Ubuntu 18.04 LTS
Note: you should stop apache before upgrade. You should back up your conf files, such as apache2.conf, php.ini, my.ini, and all VirtualHost settings.
Run simple command to upgrade.
sudo do-release-upgrade
After server restarted, login and STOP apache2 to prevent PHP short end breaks php rendering.
Enable new php short hand tag in php.ini if it is needed for your code.
sudo apt-get remove php7.2-common
sudo apt...
February 26
How to Upgrade Ubuntu 14 to 16
check current version:
lsb_release -a
Install Available Updates
apt-get update
apt-get upgrade
apt-get dist-upgrade
Stop Services
service apache2 stop
START UPGRADE
1. Install the update-manager-core package:
apt-get install update-manager-core
2. Open /etc/update-manager/release-upgrades and verify that the Prompt value is set to lts:
Prompt=lts
3. You’re now ready to begin the upgrade to Ubuntu 16.04 LTS:
do-release-upgrade
Follow the on-screen instructions to complete the installation process.
Install and Update php7.0 properly after upgrade.
note: you might want...
February 18
Quick mobile app coding test
Two features in a blank app with header & footer with following two buttons for a quick mobile app coding test:
1. embed webview in your app
2. create location items display in mobile app with map
For #1, as simple as creating a button, "go to webview", in your app, click to open a web page url in a webview. url:
For #2, call API with current...