Prevent form submitted twice

Sometimes there is issue we got double records in the database due to the form submitted twice.

Here is the way how to prevent it. A simple way

if (!$_SESSION['post_data'] == $_POST)
// process the data
// after success process, set the session to post value
    $_SESSION['post_data'] = $_POST;
// display a message that the form already submitted. 

Telegram bot to send message

This is a simple code for a telegram bot to send message to a person or to a group

function send_telegram($telegram_id, $message_text) {


        // to get group telegram id (can be in negative value)

        $url = "" . $secret_token . "/sendMessage?parse_mode=markdown&chat_id=" . $telegram_id;
        $url = $url . "&text=" . urlencode($message_text);
        $ch = curl_init();
        $optArray = array(
                CURLOPT_URL => $url,
                CURLOPT_RETURNTRANSFER => true
        curl_setopt_array($ch, $optArray);
        $result = curl_exec($ch);

Some important notes

  1. You need to create a bot using @botFather (search this bot in telegram and just follow the steps to create your own bot)
  2. Once your bot successfully created, you need to capture the secret token given
  3. To get the telegram id for user – can ask the user to send a message to @userinfobot – the telegram id is in integer
  4. To get telegram id for a group, you need to add the bot to the group and go to this link to get the group id, group id start with – (dash/negative sign)<your bot secret token>/getUpdates
  5. In order for bot able to send message to the group, you must add bot to the group
  6. In order for bot able to send message to a person, the person must send a message to the bot first


Productivity tips working from home

This post is more for my personal notes. Here are something you can do to stay productive even working at home.

1. Set a clear goal. For example to complete task A, B and C and stick to it. You don’t have to set so many goals to achieve. 3 important tasks per day is good enough.

2. Prepare a comfortable work station. Yes you can work anywhere but this place is where you’ll spend most of your time productively

3. Stay away from distraction as much as you could. Stay away from TV, from children (while you work), from your gadgets as well if it has nothing to do with your work.

4. Stick to your own productive time. Range of time where you can do your work most effectively. It can be 2 hours in the morning and 5 hours at night. During this time force yourself to finish as much work as possible.

5. Take a quick 10 minutes break every now and then. After a long working period. For example 5-10 minutes break to go to the toilet and have a drink after 40 minutes of working

6. Just do it! This is the mentality we need. Think small thing to achieve in a short time. Just start doing it right away. If you can continue working after finish the small task, it is a bonus. The key here is to START

7. Prioritize. Do what important and has most significance first.

8. Break one huge tasks to smaller ones. Then focus to finish the small tasks one at a time.

9. Share achievements with others. Good to share achievements (read progress) with your boss or if you don’t have one, with your partners or friends.

10. Be responsible! You are an adult. You know you are paid to do the work or you must complete the work. So do it because it is your responsible.

Send message to telegram via API

We can send message to a group or channel via API

What we need is token and chat_id. Bot and bot token to get from @botfather. While chat_id to get from telegram group/channel. i.e. @group_name

$token = "YOUR_BOT's_TOKEN";

$data = [
    'text' => 'your message here',
    'chat_id' => 'the_chat_id_here'

file_get_contents("$token/sendMessage?" . http_build_query($data) );

What to be on a sales page

A sales page is the most important page for you to have to help you sell online. The ultimate is to get people straight away purchase online.

Below are some tips to follow

  1. Credibility – to tell who you are and why people should listen to you and read further
  2. Build enthusiasm. What excite the users, and communicate what they want to hear. It’s not about your product, it’s all about them!
  3. Remove worries and anxieties. Money back guarantee, free trial, no credit card needed, can unsubscribe anytime etc. This will help remove barrier for people to purchase or take action
  4. Tell users WHY. People are more interested with the end result. Not the task. Forget about what they should do and how to do it. Tell they why they should do or should have.
  5. Use “people proof”. Tell success stories about real people, real business that are just like them. How skeptical there was previously, how they finally make it

Rumah untuk dijual di Taman Seri Bangi (direct owner)

Rumah untuk dijual Taman Seri Bangi (direct owner)

  • 2 tingkat
  • Bedroom: 4
  • Bathroom: 3
  • Built Up: 1650 sqft
  • Land Area: 22 x 70
  • Price: RM670k (nego/offer your price)
  • Market value: > RM700k

Kelebihan rumah

  • Parking kereta yang luas
  • Dilengkapi kitchen cabinet
  • Awning dibelakang utk jemur pakaian
  • Bahagian ruang tamu, dapur dan tangga baru dicat
  • Rumah dijaga dengan baik
  • Sebab jual, untuk berpindah ke tempat lain

Kelebihan Taman

  • Kejiranan yang baik
  • Suasana yang tenang dan selamat
  • Kawalan keselamatan 24 jam
  • Kemudahan kolam renang, bbq pit, dewan di club house
  • 3 taman permainan, 1 futsal court
  • Surau dalam taman. Boleh jalan kaki
  • Akses mudah. Betul-betul di tepi jalan besar.
  • Kemudahan bank, restoran, klinik, kedai buku di kedai hadapan


  • Pusat Bandar Bangi
  • Tol Kajang PLUS – 10 minit
  • Tol Bangi PLUS – 7 minit
  • IOI City Mall – 12 minit
  • Alamanda Putrajaya – 15 minit
  • UKM – 7 minit
  • UPM – 10 minit
  • UNITEN – 11 minit
  • KLCC – 33 minit
  • KLIA – 37 minit
  • Seremban – 35 minit

Berminat atau ada sebarang pertanyaan boleh hubungi

Azwan 012-2815182 (prefer whatsapp)

No agent please


seri bangi ground floor

Berminat atau ada sebarang pertanyaan boleh hubungi

Azwan 012-2815182 (prefer whatsapp)

No agent please

Application folder structure

This is common structure for an application folder. Normally found in most projects.

Folder structure varies by build system and programming language. Here are some standard conventions:

  • src/: “source” files to build and develop the project. This is where the original source files are located, before being compiled into fewer files to dist/public/ or build/.
  • dist/: “distribution”, the compiled code/library, also named public/ or build/. The files meant for production or public use are usually located here.
  • lib/: external dependencies (when included directly).
  • test/: the project’s tests scripts, mocks, etc.
  • node_modules/: includes libraries and dependencies for JS packages, used by Npm.
  • vendor/: includes libraries and dependencies for PHP packages, used by Composer.
  • bin/: files that get added to your PATH when installed.

Markdown/Text Files:

  • A help file which addresses setup, tutorials, and documents the project. README.txtis also used.
  • any rights given to you regarding the project. LICENSE or LICENSE.txt are variations of the license file name, having the same contents.
  • how to help out with the project. Sometimes this is addressed in the file.


  • package.json: defines libraries and dependencies for JS packages, used by Npm.
  • package-lock.json: specific version lock for dependencies installed from package.json, used by Npm.
  • composer.json: defines libraries and dependencies for PHP packages, used by Composer.
  • composer.lock: specific version lock for dependencies installed from composer.json, used by Composer.
  • gulpfile.js: used to define functions and tasks to be run with Gulp.
  • .travis.yml: config file for the Travis CI environment.
  • .gitignore: Specification of the files meant to be ignored by Git.



Learning Vue

Some notes taken while learning vue.

to start using vue can include this file.

<script src=””></script>

Vue object

  • el: “#id – define the element
  • data – define data
  • methods – define method/functions

Vue Directives

  • v-bind – can bind to any attribute in element. e.g. class, title, type, style, href
    • v-bind is use to control the html element attribute where “moustache {{ }}” cannot be used
    • example <div v-bind:class=“{ active: isActive }”></div>
  • v-if=”status”
  • v-for=“item in items” – normally use with <li> elements
  • v-on – example <button v-on:click=”callAFunction”>click me</button>
  • v-model (2 way data binding). example <input v-model=“message”>. message can be displayed as {{ message }} and can be data inside vue script
  • guide/tutorial on directive
  • full list of directives

Vue Components

Vue.component (‘name’, {


  • first argument – name of the component
  • props
  • template

API reference

vue cheat sheet