MySQL transaction

Transaction feature suitable to be used in 2 conditions.

  1. If you have multiple statements to run and want to ensure all of them run successfully to conclude the task.
  2. If you want to run a delete command, and want to ensure everything is ok before commit.

How to use

run TRANSACTION or BEGIN command

then run other statement as usual

then you have option to ROLLBACK; or to COMMIT;

other reference

Basic git flow

Basic git flow

from remote “master”,¬†create a branch “develop”.

pull branch “develop”

branch out branch “feature” or “bug” from local “develop”

commit changes to branch”feature”

push branch”feature” to remote branch”feature”

request merge to remote branch “develop”

after merged, pull branch “develop” to local

 

Billplz Notes

Billplz is a malaysian’s payment gateway. It’s free to register, easy to setup and affordable.

Register free here

If you are using postman to test, add the API Key as username in Authorization tab. Choose “Basic Auth” in Type dropdown. Then enter the URL and params as usual

 

Free tools for small businesses

Some free tools you can use to start your business. The providers normally provide the free tools for basic usage. Some limitation on features and users. But if you are small, it doesn’t matter much. At least you can start with some cool softwares to support your small business

CRM – hubspot

Support Ticket/ Help Desk – freshdesk

Accounting Рwaveapps Рneed to pay to use payroll and payments

Version control – GitLab

Getting things done

To get things done is hard sometimes (or maybe most of the times) especially those things that we don’t like to do

Follow-through is good at converting good intention to action
(from book titled The Power of Get Things Done by Steve Levinson and Chris Cooper)

You can’t rely on motivations or inspirations

You need some force to complete important tasks

  1. feel the accomplishment. how the end products benefit the people. they will be very happy, satisfied, your business will grow, you will get more money etc etc
  2. take your intention more seriously, lot more seriously
  3. commit to a deadline and commit to real people
  4. start small but start now
  5. focus only on single task to do, write the rest in a list
  6. get a mentor or coach that can force you to do right things right
  7. surround yourself with people who are committed to success (network group)
  8. do things at place where people normally do that things. e.g. if to do work, go to office, if to pray, go to mosque. just go
  9. ask/pay someone that can get it done faster even you can also capable of doing it

You need to stay away from distractions

  1. stay away from people who distracts you
  2. put away gadgets and off the tv and other distractions
  3. write down all other things that come on your mind when you are focusing on a task

Multiple database in CodeIgniter

How to connect to more than one database in codeigniter

Database config

$db[‘default’][‘hostname’] = “localhost”;
$db[‘default’][‘username’] = “root”;
$db[‘default’][‘password’] = “”;
$db[‘default’][‘database’] = “database_name”;
$db[‘default’][‘dbdriver’] = “mysql”;

set another config for 2nd database

$db[‘otherdb’][‘hostname’] = “localhost”;
$db[‘otherdb’][‘username’] = “root”;
$db[‘otherdb’][‘password’] = “”;
$db[‘otherdb’][‘database’] = “other_database_name”;
$db[‘otherdb’][‘dbdriver’] = “mysql”;

Sample to call

//Load another database
$DB2 = $this->load->database(‘another_db’, TRUE);

//Default database query
$this->db->select(‘first_name, last_name’);
$this->db->from(‘users’);
$this->db->where(‘id’, 99);
$query = $this->db->get();

//Another database query
$DB2->select(‘image’);
$DB2->from(‘cdn_images’);
$DB2->where(‘id’, 25);
$query = $DB2->get();

 

References

codexworld.com/connect-use-multiple-database-codeigniter

 

Focus and single-tasking

Focus is important. To focus is to do only one single task at a given time. But this is very hard to do.

Follow the following steps

1. Remove all distractions – silent and put away the smart phones, disable all notifications (email, messenger etc), stay away from people who love to disturb you etc

2. start small – start with 10 minutes focus time to do one small task and let youurself drawn into the task further without you know. split tough and huge tasks to smaller ones to achieve. Most important is to have PROGRESS

3. take a meaningful break. Focus is tiring. So take a solid and meaningful 10 minutes break everytime you complete a tough task. For example, drink water, stretching, have a meaningful and necessary discussions with colleague, check emails/messenger etc