Monday, 30 April 2018

Redirected after Login or Register

in Login Controller, it was located under Illuminate\Foundation\Auth\AuthenticatesUsers;

then change this function to :

  /**
     * The user has been authenticated.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  mixed  $user
     * @return mixed
     */
    protected function authenticated(Request $request, $user)
    {
      return redirect('/admin');
    }


while for Register Controller, it was located under Illuminate\Foundation\Auth\RegistersUsers;

then change this function to : 

    /**
     * The user has been registered.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  mixed  $user
     * @return mixed
     */
    protected function registered(Request $request, $user)
    {
        return redirect('/admin');
    }

however RegisterController has a constant variable   protected $redirectTo = '/home'; which you can just change their value to your target url.

reference 

https://stackoverflow.com/questions/44173616/laravel-5-4-how-do-i-find-logincontrollershowloginform

https://stackoverflow.com/questions/42177044/laravel-5-4-redirection-to-custom-url-after-login

Saturday, 28 April 2018

Friday, 27 April 2018

Merging Input Request

Often you want to pass value for input type hidden, this can be submitted by merging with another form request to the controller





Reference

https://stackoverflow.com/questions/23073633/laravel-change-input-value/36549464#36549464

Wednesday, 25 April 2018

Layer 1 - Physical Layer

Ethernet and Ethernet based cables to make L1 connection happer.

Ethernet

- speeds , cap
- including unshielding twisted-pair (utp) , shielding twisted copper (stp)
- twisting cables minimize the effect of EMI from outside sources
- twisting cables lessens the amount of EMI from going out from cable itself.
- stp easily damaged and cost more
- fibre optic is cost more from copper cable
- have a maximum cable of 100 meters
- switching between ethernet speeds and capabilities would be not problem because
ethernet has standards as below.

copper based standards :
- regularly runs at 10 Mbps
- IEEE name :  10BASE-T
- fast ethernet, clocking at 100Mbps, IEEE name standard is 802.3u (100Base-T)
- normal Ethernet and fast Ethernet use only two pair  of wires out of the four available
- Gigabit Ethernet, bringing 1000Mbps, IEEE name stnadard 802.3ab (1000Base-T)
- while gigabit ethernet use all four pair of wires in the cable
- 10 Gig Ethernet runs at 10Gbps, IEEE name standard is 802.3an (10GBase-T)

the fibre optic standard :
- fiber standards jump right to Gigabit Ethernet, running at 1000Mbps
- network admins call it 1000Base-LX, while IEEE standard is 802.3z

Cable Types 

Crossover and straight through cabling
- for the host to switch connections, we'll need straight through cables, so named because the wires in the cable run straight from a particular pin at the host end to the same numbered pin at the switch end.


-whilst switch to swith connection using crossover cable since transmit ports and receive port needed to be different at one end pin.


- Auto MDI-X  (Automatic Medium-Dependent Interface Crossover), eventually cisco switch got automatic discover cable if newly straight-through cable were set up between two switch. You need to set cisco switch port, set speed, duplex and mdix to auto that port.

**auto mdi-x formula*
same device = crossovercable
not same type of devices = straight-through cable

SW1(config)#int fast 0/1
SW1(config-if)#speed auto
SW1(config-if) #duplex auto
SW1(config-if)#mdix ?
auto Enable automatic MDI crossover detection on this interface
SW1(config-if)#mdix auto

Ethernet Header

Preamble | Start Frame Delimiter (SFD) | Dest. MAC Address | Source MAC Address | Protocol Type

Definitions
1. Preamble : A seven-byte set of alternating ones and zeroes 10101010, repeated seven times. Used for clock synchronization.

2. SFD : One-byte field set to 10101011, used to indicate preamble's end and that the destination MAC address will immediately follow.

3. Destination MAC Address : The frame's destination.

4. Source MAC address : The frame's  source

5. Protocol Type : Can be IPV4 protocol and occasionally IPV6.

Ethernet Trailer

1. Frame Check Sequence (FCS)
- strictly for error detection, 
2. Cyclic Redundancy Check ( a complex mathematical operation )
- sender arrives at a value by running a cyclic redundancy check against the data contained in the frame, resulting in a numeric value. that value is placed into FCS and the frame is then transmitted.
- the recepient of the frame will run the same CRC against frame's data and compares the answer to that contained in incoming CRC. if the compared values are the same, the frame is non-corrupt and life goes on. otherwise the frame is corrupted and will be discarded.


Hubs

Also known as single collision domain.
Now to prevent the loss of data and time associated with collisions, Carrier Sense Multiple Access
with collision detection (CSMA/CD) was developed. Here's the CSMA/CD process:

1. before sending data, a host will check to see if any other host is already sending data.

2. if that check reveals another host is sending data, the host backs off for a few miliseconds before it listens to the same wire again. If no one's sending data, the host sends the data signal.

3. if 2 PCs happen to send data at the exact time after listening to the wire, the voltage on the wire itself changes, signaling to the hosts that a data collision has occured.

4. The PCs that sent the data will generate a jam signal, indicating to other hosts that data should not be transmitted at this time.

Disadvatages of hub :

1. high level of delay sensitivity when handling voice and video traffic. (one big collision domain)

2. every single time a host connected to this hub sends a broadcast, every other host on that hub will receive a copy of that broadcast. there is no other way to limit the scope of the broadcast and preventing the unnecessary spreading (propagation) of a broadcast through network.

Quick Review

1. hubs give us one collision domain consisting of all connected hosts, one broadcast domain containing those same hosts, and allow only one host to transmit a time.

2. bridges allow us to logically segment the network and to lessen the size of collision domains, but do nothing to segment broadcast domains.

3. switches bring us one-host collision domains and the capability to logically segment the broadcast domain, although that's not done by defa  ult.


Monday, 23 April 2018

CSS - Simple Hover Effects Button

You can add some animation that capture user attention when they hovering buttons (may applied on cards)

Reference :

https://codepen.io/giana/pen/BZaGyP?editors=1100


Inherit "keyword" css reference


<!DOCTYPE html>
<html>
<head>
<style>
span {
    color: blue;
    border: 1px solid black;
}
.extra span {
    color: inherit;
}
</style>
</head>
<body>

<div>
Here is <span>a span element</span> which is blue, as span elements are set to be.
</div>

<div class="extra" style="color:green">
Here is <span>a span element</span> which is green, because it inherits from its parent.
</div>

<div style="color:red">
Here is <span>a span element</span> which is blue, as span elements are set to be.
</div>

</body>
</html>

Wednesday, 4 April 2018

Remove /Public folder (Laravel)

Step 1. Create .htaccess file in root directory

Step 2. Edit .htaccess file to following code

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ ^$1 [N]

    RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
    RewriteRule ^(.*)$ public/$1

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ server.php

</IfModule>

Tuesday, 3 April 2018

LAN SWITCHING

This knowledge will be covered on CISCO CCIE topics.

Topic that will covered :

1. Ethernet Basics
2. Virtual LANs and VLAN Trunking
3. Spanning Tree Protocol

FAST ETHERNET
Fast Ethernet standard is a networking that supports data transfer rates up to 100 Mbps. 100Base-T is based on the older Ethernet standard . Because it is 10 times faster than Ethernet, it is often referred to as Fast Ethernet. Officially, the 100Base-T standard is IEEE 802.3u.

Like Ethernet, 100BASE-T is based on the CSMA/CDLAN access method. There are several different cabling schemes that can be used with 100BASE-T, including :

100BASE-TX : two pairs of high-quality twisted-pair wires
100BASE-T4 : four pairs of normal-quality twisted-pair wires
100BASE-FX : fiber optic cables

Normal vlan gateway last resort is 10.10.0.1 to network 0.0.0.0