Thursday, 27 December 2018

2) Angular : 3 Must Component file

component need at least this 3 component file


1. customers.component.ts

import { Component, OnInit } from '@angular/core';

@Component ({
selector: 'app-customers',
templateUrl:'./customers.component.html'
})
export class CustomersComponent implements OnInit{
title: string;
people: any[];

constructor(){}
ngOnInit() {
this.title = 'Customers';
this.people = [
{ id: 1, name: 'john Doe', city: 'Phoenix', orderTotal: 9.99, customerSince: new Date(2014, 7, 10) },
{ id: 2, name: 'Jane Doe', city: 'Chandler', orderTotal: 19.99, customerSince: new Date(2017, 2, 22)},
{ id: 3, name: 'Michelle Thomas', city: 'Seattle', orderTotal: 99.99, customerSince: new Date(2002, 10, 31)},
{ id: 4, name: 'Jim Thomas', city: 'New York', orderTotal: 599.99, customerSince: new Date(2002, 10, 31)},
];
}
}



2. customers.module.ts - membolehkan selector dirender pada html

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { CustomersComponent } from './customers.component';

@NgModule({
imports: [ CommonModule ],
declarations: [ CustomersComponent ],
exports: [ CustomersComponent ] // buang bootstrap dan ganti dengan ini
})
export class CustomersModule { }


3. costumers.component.html - tempat keluar render

<h1> {{ title }}</h1>
<br>
Customers Go here

1) Angular : App Component Ts






import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-root',
template: `
<h1>{{ title }}</h1>
`
})
export class AppComponent implements OnInit {
title: string;
constructor() { }

ngOnInit() {
// We call a service that gets us the data
this.title = 'Hello World';
}
}

Thursday, 29 November 2018

Photoshop Select Only Black

short way: Ctrl+Alt+2 and then Ctrl+Shift+i
the long way: ctrl+click the RGB channel in the Channels panel and then go to Select->Inverse
and there are a ton of other ways as well including using the magic wand tool, quick select tool, Select->Color Range(with localized off), etc

Tuesday, 13 November 2018

APK TOOL

https://ibotpeaches.github.io/Apktool/install/

JQUERY : Lets play with variation + Object

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Challenge: Famous discoveries</title>
    </head>
    <body>
   
    <h1>Famous discoveries</h1>
   
    <h2 id="math-heading">Math discoveries</h2>
   
    <ul>
    <li>323–283 BC – Euclid: wrote a series of 13 books on geometry called The Elements</li>
    <li>Al-Khawarizmi (780-850): wrote the first major treatise on Algebra titled "Al-jabr wal-muqabaleh"</li>
    </ul>
   
    <h2 id="science-heading">Science discoveries</h2>
    <ul>
        <li>1543 – Copernicus: discovered the heliocentric model of the solar system.
</li>
        <li>1672 – Sir Isaac Newton: discovers that white light is a spectrum of a mixture of distinct coloured rays.</li>
    </ul>
   
    <a href="https://en.wikipedia.org/wiki/Timeline_of_scientific_discoveries">Read about more discoveries on Wikipedia.</a>
   
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <script>
   
    var math = $("#math-heading");
    math.text(math.text() + "!! WOW!");
    var science = $("#science-heading");
    science.text(science.text() + " Walla!")
   
    </script>
    </body>
</html>

Sunday, 11 November 2018

DIVI : Search Placeholder

Tukar divi search Placeholder. Letak code ni di bahagian Integration > Head di divi option

<script>
jQuery(function($){
    $('.et-search-field').attr('placeholder', 'RECHERCHE').css('opacity','1'); 
});
</script>
<style>
.et-search-field { opacity: 0; }
</style>

Saturday, 10 November 2018

CSS : Center Everything (Image) In Center Of Pages

.centered { position: fixed; top: 50%; left: 50%; /* bring your own prefixes */ transform: translate(-50%, -50%); }

Monday, 5 November 2018

Media query

/* for Big PC & Display */
@media only screen and (min-width: 1900px) {

.tps-section {
height: 1080px;
}

}

/* for Laptop and PC */
@media only screen and (min-width: 1366px) and (max-width: 1900px) {
.tps-section {
height: 786px;
}
}

/* for Tablet & Small Laptop */

@media only screen and (min-width: 991px) and (max-width: 1366px) {
}

/* for mobile & tablet */

@media only screen and (min-device-width : 360px) and (max-width: 991px) {
.tps-section .tps-wrapper h1 a{
padding-top: 25%;
padding-left:8px;
padding-right:8px;
line-height: 16px;
}
.tps-section {
height: 300px;
}
}

/* End Mobile Query */

Tuesday, 30 October 2018

What in the world veni vidi vici

Berapa banyak telah dihapuskan
mengapa kita tak bersatu
Berapa lama hendak diagungkan
sedangkan mereka membunuh

hanyut selesa berada ditempatmu
duduk berdiam diri dari atas bangku

Telah lama kita dipalsukan
cerita yg benar ditutup
Sudah menyelinap umpama asap
racunnya telah dihidu

telah ditutup telinga mata dan hati
terikat pada istilah weni widi wiki

cuba dihitungkan harian
cuba dikira perbuatan
apa yang telah kita lakukan
selama ini...

what in the world, the money we spending..
what in the world, the life we living..
what in the world, the written we reading
what in the world what in the world?

What in the world, the tought we thingking
what in the world, the word we speaking
what in the world, the love we hating
what in the world what in the world!

Thursday, 25 October 2018

JS : Contenteditable Save data at local

 //editable cookies enable

 $(function(){
    var liveEdit = document.getElementById('live-edit');

    $(liveEdit).blur(function(){
      localStorage.setItem('liveEditData', this.innerHTML);
    });

    //when the page loads

    if ( localStorage.getItem('liveEditData')){
      liveEdit.innerHTML = localStorage.getItem('liveEditData');
    }
  });

    //end function of contenteditable

  $(function(){
    var editUser = document.getElementById('edit-user');

    $(editUser).blur(function(){
      localStorage.setItem('editUserData', this.innerHTML);
    });

    //when the page loads

    if ( localStorage.getItem('editUserData')){
      editUser.innerHTML = localStorage.getItem('editUserData');
    }
  });

      //end function of contenteditable
  

Thursday, 11 October 2018

JAVASCRIPT : BOOTSTRAP DROPDOWN PILL OR ACCORDION USING DROPDOWN

<div class="dropdown">
    <a class="btn btn-danger dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown"
        aria-haspopup="true" aria-expanded="false">
        Senarai Pegawai
    </a>

    <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
        <ul class="nav nav-pills flex-column list-unstyled" role="tablist">
            <li class="nav-item list-unstyled">
                <a class="nav-link active umum" data-toggle="pill" href="#semua-unit">SEMUA UNIT</a>
            </li>
            <li class="nav-item list-unstyled">
                <a class="nav-link umum" data-toggle="pill" href="#unit-satu">UNIT SATU</a>
            </li>
            <li class="nav-item list-unstyled">
                <a class="nav-link umum" data-toggle="pill" href="#unit-dua">UNIT DUA</a>
            </li>
            <li class="nav-item list-unstyled">
                <a class="nav-link umum" data-toggle="pill" href="#unit-tiga">UNIT TIGA</a>
            </li>
            <li class="nav-item list-unstyled">
                <a class="nav-link umum" data-toggle="pill" href="#unit-empat"> UNIT EMPAT</a>
            </li>
        </ul>
    </div>
</div>

<div style="margin-top:50px"></div>

<!-- Tab panes -->
<div class="tab-content">
    <div id="welcome" class=" tab-pane fade">

        <h1>SELAMAT DATANG KE DIREKTORI PEGAWAI</h1>

    </div>



    <div id="semua-unit" class=" tab-pane active">

        Semua unit loading...

    </div>




    <div id="unit-satu" class="tab-pane fade">

        Coming soon

    </div>

    <!-- start business data-->

    <div id="unit-dua" class="tab-pane fade">


        Coming soon

    </div>

    <div id="unit-tiga" class=" tab-pane fade">

        Coming soon

    </div>

    <div id="unit-empat" class=" tab-pane fade">

        Coming soon

    </div>
    <!--improvement tab-->
</div>
<!--tab content-->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>

Wednesday, 3 October 2018

CHARTJS : CHANGE LABEL SIZE


var ctx = document.getElementById('myChart').getContext('2d');
var chart = new Chart(ctx, {
    // The type of chart we want to create
    type: 'radar',

    // The data for our dataset
    data: {
        labels: ["Entrepreneur Capability", "Business Capacity", "Product Strength", "Technological Potential", "User Performance", ],
        datasets: [{
            label: "BUSINESS HEALTH SCORE",
            backgroundColor: '#c72b34bf',
            borderColor: '#c72b34bf',
            data: [10, 20, 40, 60, 50, ],

        }]
    },

    // Configuration options go here
    options: {
        scale: {
            pointLabels: {
                fontSize: 18,
            }
        }
    }
});

Tuesday, 2 October 2018

DIVI : Message Pattern

My name is %%Name%%,
 my message is %%Message%%
 and email address is %%Email%%.

add %%id%% to get the input value.

Saturday, 29 September 2018

Wordpress : Change Port of Localhost

Search this line

define('DB_COLLATE', '');
add this after/below it

define( 'DB_HOST', '127.0.0.1:3307' );

Next go to phpMyAdmin database and open wp_options



click to open large
Change this port number




Then it settle, you should able to serve on port that you've change to.

Friday, 28 September 2018

Wordpress : Unable to download plugin in localhost

If you using appserve or easyphp this could be the solution for you.. suddenly your wordpress in localhost inform you that


Download failed.: No working transports found
Installation Failed

👋😅😤😣😝😝😝

Editing php.ini file

The php.ini file contains a list of many extensions with some of them disabled by default. The only one I had to enable was the openssl extension.
Here are the steps to enable that extension:
  1. Open File Explorer and locate the php folder of the EasyPHP application. On Windows 10, it should be:
    C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-binaries\php
  2. You will see two folders inside, one for PHP version 5.6.19 and one for the 7.0.4 version. Select the one the Apache server is using. If you are unsure, open the EasyPHP Dashboard and check the PHP number under "HTTP SERVER".
  3. Open php.ini file in your favorite text editor and search for php_openssl.dll text. You should see that the extension is commented out:
    ;extension=php_openssl.dll
  4. Uncomment that line by removing ; character and save the changes.
  5. All that is left is to restart the Apache server and we are done.
After going through the steps above, the WordPress site on my development server was able to update plugins without any problem. If you still have issues, try also to enable curl extension extension=php_curl.dll.
Note: To restart the Apache, right-click on the EasyPHP notification icon, then select Open Dashboardto stop / start the Apache server.
https://www.howtosolutions.net/2017/01/easyphp-wordpress-no-working-transports-found-error/

WORDPRESS : Increase media file size

paste this code inside .htaccess



php_value upload_max_filesize 64M
php_value post_max_size 128M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300

still not success?

Ok maybe in your theme function.php add this at the bottom


@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );

Ok c'mon.. still not success? maybe you can create php.ini save it at root of the folder same in your index.php

paste this inside php.ini

upload_max_filesize = 25M
post_max_size = 13M
memory_limit = 15M

Localhost to internet

There are couple of good free service that let you do the same. Ideal for showing something quickly for testing:

Thursday, 27 September 2018

JQUERY : DOM manipulation / Change id content using jquery

Same as javascript getElementById("");

FOR TEXT

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

</head>
<body>

<div id="demo">
   <p>The initial text</p>
</div>


<script>
$(document).ready(function(){
  $('#demo').text('The replaced text.');
});
</script>
</body>
</html>

FOR HTML




<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

</head>
<body>

<div id="demo">
   <p>The initial text</p>
</div>


<script>
$(document).ready(function(){
  $('#demo').html('<b>The replaced text.</b>');
});
</script>
</body>
</html>

PHP : Enable and disable Permission to access external .php file

Add this to the page that you want to only be included
<?php
if(!defined('MyConst')) {
   die('Direct access not permitted');
}
?>
then on the pages that include it add
<?php
define('MyConst', TRUE);
?>

Sunday, 23 September 2018

PHP navbar using if condition & form to view content

<div class="navigation-bar" style="margin:1em 30%;">
<form action="" method="POST" style="display:inline;">
    <input type="submit" value="Hello World" name="about" class="btn">
    </form>
<form action="" method="POST" style="display:inline;">
    <input type="submit" value="How Are You" name="how" class="btn">
    </form>
<form action="" method="POST" style="display:inline;">
<button type="submit" value="How Are You" name="home" class="btn"> Home </button>
</form>
</div>
<br>
    <?php
       if (isset($_POST["about"]))
      {
        echo "Hello World";
    };
        if (isset($_POST["how"]))
        {
        echo "hello world How are you today";
    };
    if (isset($_POST["home"])) {
    include "ifelse.php";
    }
    ?>
  

Wednesday, 12 September 2018

VUE : Component Structure

In html


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html lang="en">

<head>

    <title>Component No1</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.css">
    <style>
    body{
        padding-top:40px;
    }
    </style>


</head>

<body>


    <div id="root" class="container">

        <componentName title="Hello World" body="lorem ipsum dolar sit amet."></componentName>        <componentName title="Success" body="creating component by using props on components"></componentName>
        
     

    </div>



    <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
    <script src="component.js"></script>

</body>

</html>

In JS

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Vue.component('componentName', {

    props: ['componentProps',],

    data(){
        return{
            componentCondition: true, //boolean
        }

    },
    
    template: `
    <article class="message is-warning" v-show="inVisible">
    <div class="message-header">

      {{ title }} 
      <button type="button" @click="clickMethod">x</button>

    </div>
    <div class="message-body">
      {{ body }}

      </div>
    </article>
    `,

    methods:{
        clickMethod(){
            this.componentCondition = false; //methods is events+data= result

        }
    }
});

new Vue({
    el:'#root' //div id on html
});

Tuesday, 11 September 2018

VUEJS : Todo


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<html lang="en">

<head>

    <title>Document</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">


</head>

<body>



    <div id="root">

        <ul>
            <li v-for="name in names" v-text="name"></li>
        </ul>

        <input id="input" type="text" v-model="newName">
        <button v-on:click="addName"> Add Name</button>
        

    </div>



    <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
    <script>
        var dev = new Vue({
            el: '#root',
            

            data: {
                names: ['hafiz', 'muhaza', 'spikey'],
                newName:'',
            },

            methods:{
                addName() {
                    this.names.push(this.newName);
                }
            }

        })



    </script>

</body>

</html>
..

https://laracasts.com/series/learn-vue-2-step-by-step/episodes/3

Saturday, 1 September 2018

Javascript : .innerHtml & .textContent


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 <span id="mangsa">Dokument syarikat</span>
            
  
    <script>
        var kuliPencuri = document.getElementById("mangsa");

        var bosPencuri = function() {

            kuliPencuri.innerHTML = `<b>Dokument syarikat</b>`;
            
        };

        kuliPencuri.addEventListener("click", bosPencuri);

        
        </script>
..

This will show result as HTML render.




 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 <span id="mangsa">Dokument syarikat</span>
            
  
    <script>
        var kuliPencuri = document.getElementById("mangsa");

        var bosPencuri = function() {

            kuliPencuri.textContent = "Dokument Palsu";
            
        };

        kuliPencuri.addEventListener("click", bosPencuri);

        
        </script>
..

This will show raw HTML not rendered

http://xahlee.info/js/js_textContent_innerHTML_innerText_nodeValue.html

Tuesday, 28 August 2018

hide component in angular 4

hide component in angular 4

<app-header *ngIf="1==2"> </app-header>

Sunday, 26 August 2018

Javascript : Click Event Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
<div style="background-color:#D94A38;width:170px;height:80px;margin:20px;padding-top:20px;color:#ffffff;font-weight:bold;font-size:18px;float:left;text-align:center;" onclick="clickMeEvent(this)">Click Me</div>

<script type="application/javascript">
function clickMeEvent(obj) {
  if (obj.innerHTML == "Click Me") {
    obj.innerHTML = "Click Me<br>Click Me Again";
    return;
  }
  if (obj.innerHTML == "Click Me<br>Click Me Again") {
    obj.innerHTML = "Thank You";  
    return; 
  }
  if (obj.innerHTML == "Thank You") {
  obj.innerHTML = "Goodbye";  
    return; 
  }
  if (obj.innerHTML == "Goodbye") {
    obj.style.display = "none";
    return;
  }
}
</script>

Friday, 3 August 2018

React : if else statement

IF ELSE statement boleh dikatakan penting untuk membuat keputusan dalam programming..
react tidak mempunyai shortcut seperti mana framework yang lain ia menggunakan skill javascript yang ori cuma dengan gaya react

1. if else

if (coinToss() === 'heads') {
  img = (
    <img src={pics.kitty} />
  );
} else {
  img = ( 
    <img src={pics.doggy} />
  );
}
..

if coinToss = heads
img = img pics.kitty,
else
img = img pics.doggy

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import React from 'react';
import ReactDOM from 'react-dom';

function coinToss() {
  // This function will randomly return either 'heads' or 'tails'.
  return Math.random() < 0.5 ? 'heads' : 'tails';
}

const pics = {
  kitty: 'https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-kitty.jpg',
  doggy: 'https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-puppy.jpeg'
};
let img;

// if/else statement begins here:
if (coinToss() === 'heads') {
  img = (
    <img src={pics.kitty} />
  );
} else {
  img = ( 
    <img src={pics.doggy} />
  );
}

ReactDOM.render(img, document.getElementById('app'));
..

2. Or using ternary Operator



1
const img = <img src={ pics[coinToss() === 'heads' ? 'kitty' : 'doggy'] } />;
..

scenario : if coinToss = head it should display kitty else its doggy

HOW TO WRITE OR ITS STRUCTURE?

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
import React from 'react';
import ReactDOM from 'react-dom';

function coinToss () {
  // Randomly return either 'heads' or 'tails'.
  return Math.random() < 0.5 ? 'heads' : 'tails';
}

const pics = {
  kitty: 'https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-kitty.jpg',
  doggy: 'https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-puppy.jpeg'
};

const img = <img src={ pics[coinToss() === 'heads' ? 'kitty' : 'doggy'] } />;

ReactDOM.render(
 img, 
 document.getElementById('app')
);
..

2. USING && CONDITION



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
import React from 'react';
import ReactDOM from 'react-dom';




// judgmental will be true half the time.
const judgmental = Math.random() < 0.5;

const favoriteFoods = (
  <div>
    <h1>My Favorite Foods</h1>
    <ul>
      <li>Sushi Burrito</li>
      <li>Rhubarb Pie</li>
      { !judgmental &&<li> Nacho Cheez Straight Out The Jar</li>}
      <li>Broiled Grapefruit</li>
    </ul>
  </div>
);

ReactDOM.render(
 favoriteFoods, 
 document.getElementById('app')
);
..

email mailto: pretext

 <a href="mailto:designoutsourced.com+info@gmail.com?subject=Maklumat%20lanjut%20pakej&body=Hai,%20saya%20berminat%20tahu%20lebi...