Posts

Showing posts from 2021

TimeZone in CodeIgnitor 3

Check your current php timezone with :  echo ini_get('date.timezone');  If the result is not your current timezone. You can change in "php.ini" from :  date.timezone=Europe/Berlin  to : date.timezone=Asia/Bangkok Or if you cannot change your "php.ini", add the following code in the "index.php" file of your application root. <?php date_default_timezone_set ( 'Asia/Bangkok' ); ?>

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0"

Image
Solution: 1. add this line in config object of composer.json file "platform-check": false 2. open Terminal and run php artisan config:cache 3. then run composer dump-autoload ## Refererence from : stackorverflow.com

JavaScript - GroupBy Array Object

## Ref from : stackoverflow.com

Javascript - Async/Await (Promise)

Reference 1 : async/await เรามารู้จัก syntax ที่จะมาเปลี่ยนโลกของ javascript กัน by Panjamapong Sermsawatsri Reference 2 : Tips For Using Async/Await in JavaScript by James Q Quick

Groovy GPATH Example

Image
You can copy the code and execute on https://www.tutorialspoint.com/execute_groovy_online.php to see how difference between result in case of it.title.text() and it.title;

phpMyAdmin - Wrong permissions on configuration file

Image
 If you found error "wrong permissions on configuration file, should not be world writable!" when call phpMyAdmin page (localhost), please change file "phpMyAdmin/config.inc.php" permission. Ex. sudo chmod 755 / your_directory /phpmyadmin/config.inc.php

Git - Set local folder to remote git repository

1. Create a new repository on your Git Server 2. Open Terminal and  change the current working directory to your local project. 3.  Initialize the local directory as a Git repository.     $ git init 4.  Add the files in your new local repository. This stages them for the first commit.      $ git add . 5.  Commit the files that you've staged in your local repository.      $ git commit -m "First commit" 6.  add the URL for the remote repository where your local repository will be pushed.      $  git remote add origin http://localhost:3000/IRPC/fiori-iSmart.git 7.  Push the changes in your local repository to GitHub if there is a remote branch called  master  (or  main  if that's what you're using)     $  git push origin master below is example command that generate from Gitea. touch README.md git init git add README.md git commit -m "first commit" git remote a...

Git - Delete File & Folder from Git (CLI)

# Delete Folder From Git (Remote Server) 1. Go to your project directory  2. $ git pull        (Make your reposition up to date) 3. $ git -rm -r your-folder-name        (The rm -r command will recursively remove your folder) 4. $ git commit -m "your text to note when commit"        (Commit the change) 5. $ git push origin master        (Push the change to your remote repository) # Delete File From Git (Remote Server) 1. Go to your project directory  2. $ git pull        (Make your reposition up to date) 3. $ git rm file1.txt 4. $ git commit -m "your text to note when commit"        (Commit the change) 5. $ git push origin master        (Push the change to your remote repository) **  if you want to remove the file only from the Git repository and not remove it from the filesystem, use: $ git rm --cached file1.txt $ git commit -m "remov...

XAMPP - Start/Stop Apache, MySQL and change root password (MySQL) on MACOS

Image
/*---------------------------------------*/ /* start/stop XAMPP /*---------------------------------------*/ 1. Open Terminal 2. cd /Applications/XAMPP/xamppfiles 3. sudo ./xampp start 4. sudo ./xampp stop ** sudo ./xampp startapache ** sudo ./xampp startmysql  ** sudo /Applications/XAMPP/xamppfiles/xampp start ** sudo /Applications/XAMPP/xamppfiles/xampp status ** sudo /Applications/XAMPP/xamppfiles/xampp help /*---------------------------------------*/ /* mySQL - change root password /*---------------------------------------*/ 1. Open Terminal 2. /Applications/XAMPP/xamppfiles/bin/mysql -u root 3. SET PASSWORD FOR 'root'@'localhost' = PASSWORD('lemonade'); /*---------------------------------------*/ /* mySQL - create new user /*---------------------------------------*/ 1. Open Terminal 2. /Applications/XAMPP/xamppfiles/bin/mysql -u root -p 3. CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; 4. login to phpMyAdmin to assign pri...

Composer

How to use composer.  1. Install composer please read https://getcomposer.org/   2. Find your package at https://packagist.org/ 3. Use command composer require vendor/package:version          ex.  composer require refinery29/test-util:0.10.2  or  composer require middlewares/whoops "^0.4"     **  Tilde Version Range ( ~ ) - ~1.2.3 is equivalent to >=1.2.3 < 1.3.0 Caret Version Range ( ^ ) - ^1.2.3 is equivalent to >=1.2.3 < 2.0.0   4. If you need to update package, run  composer update vendor/package:version

Solution if you got problem with sys_temp_dir

Image
If your problem with sys_get_temp_dir is permission denied. I have some solutions that's work. # Solution 1: Change sys_temp_dir by use putenv(); # Solution 2: For CodeIgniter, I found permission denied in $config['sess_save_path'] which the default value is map to 'sys_get_temp_dir()'. So, I change value to the folder that have permission (Ref. to https://forum.codeigniter.com/thread-64570.html )

PHP - Set Temp Directory