JavaScript Array Sorting and Data Manipulation Techniques

Sorting Objects by Last Name

const people = [
  { id: 1, name: "John Wilson" },
  { id: 2, name: "Emma Johnson" },
  { id: 3, name: "Michael Brown" },
  { id: 4, name: "Sophia Davis" },
  { id: 5, name: "William Zoy" },
  { id: 6, name: "Olivia Martine" },
];

people.sort((a, b) => {
  let lastNameA = a.name.split(" ")[1];
  let lastNameB = b.name.split(" ")[1];
  return lastNameA.localeCompare(lastNameB);
});

console.log(people);

Sorting Students by Name

const students = [
  { name: "Alex", points:
Read More

Cisco IOS Configuration for VLANs, AAA, and EtherChannel

Router R1: DHCP and RADIUS Configuration

This section details the configuration for Router R1, including interface addressing, DHCP pools for laboratories, and RADIUS authentication.

enable
configure terminal
hostname R1

! Interface towards S1 (Laboratories LAN)
interface GigabitEthernet0/1
 ip address 192.168.10.1 255.255.255.0
 no shutdown

! Interface towards R2 (WAN link)
interface GigabitEthernet0/2
 ip address 10.10.10.1 255.255.255.0
 no shutdown

ip dhcp excluded-address 192.168.10.1 192.
Read More

Essential PL/SQL Triggers, Procedures, and DDL Examples

Database Triggers for Data Integrity

Create table emp1 and dept1 same as emp and dept. Create a trigger which will delete all records from emp1 table of corresponding department deleted from dept1 table.

CREATE TABLE emp1 AS SELECT * FROM emp;
CREATE TABLE dept1 AS SELECT * FROM dept;

CREATE OR REPLACE TRIGGER trg_delete_emp1
AFTER DELETE ON dept1
FOR EACH ROW
BEGIN
    DELETE FROM emp1 WHERE deptno = :OLD.deptno;
END;
/

Create table totalsal as select deptno, sum(sal) sal from emp1 group by deptno.

Read More

Essential Cisco IOS Configuration Commands

Cisco IOS Navigation and Modes

User mode: Switch>

Enter Privilege mode: Switch>enable

Privileged mode: Switch#

Enter configuration mode: Switch#configure terminal

Global Config mode: Switch(config)#

Enter Interface mode: Switch(config)#interface fa0/1

Interface mode: Switch(config-if)

Return to global configuration: Switch(config-if)exit

Exit Global Config mode: Switch(config)#exit

Return to user mode: Switch#disable

Logout: Switch>exit

Essential Keyboard Shortcuts

  • Recall Previous command: Up arrow
Read More

Cisco Network Configuration: IPv6, OSPF, and HSRP Setup

Part 1: Network Infrastructure and Addressing

Task 1: IPv6 Interface Configuration

Router A1

enable
configure terminal
ipv6 unicast-routing
interface g0/0
ipv6 address 2001:1:1:1::2/64
no shutdown
interface s0/0/0
ipv6 address 2001:c1c0:34:11::1/64
no shutdown
clock rate 2000000
interface s0/0/1
ipv6 address 2001:c1c0:34:12::1/64
no shutdown
clock rate 2000000

Router A2

enable
configure terminal
ipv6 unicast-routing
interface g0/0
ipv6 address 2001:c1c0:34:1::1/64
no shutdown
interface s0/0/0
ipv6 address 2001:c1c0:34:11:

Read More

Practical SQL Examples for Database Management

Student and Course Database Examples

Database Creation

It’s good practice to create a dedicated database for your tables.

-- Create a new database (optional, good practice)
CREATE DATABASE IF NOT EXISTS StudentDB;
USE StudentDB;

Table Creation

Here, we define the Student and Course tables. Note the use of PRIMARY KEY, FOREIGN KEY, NOT NULL, UNIQUE, and CHECK constraints.

CREATE TABLE Student (
    StudentID INT PRIMARY KEY AUTO_INCREMENT,
    Name VARCHAR(100) NOT NULL,
    Dept VARCHAR(50),
    Age INT,
Read More