Chandan Shakya's Blog

SQL Conventions for Laravel

  1. Table Names:
    • Plural, snake_case (e.g., users, posts)
  2. Column Names:
    • Snake_case (e.g., user_id, created_at)
  3. Primary Keys:
    • id, auto-incrementing integer
  4. Foreign Keys:
    • Related table name + _id (e.g., user_id)
  5. Timestamps:
    • created_at, updated_at
  6. User Table:
    CREATE TABLE users (
        id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
        name VARCHAR(255) NOT NULL,
        email VARCHAR(255) UNIQUE NOT NULL,
        password VARCHAR(255) NOT NULL,
        remember_token VARCHAR(100),
        created_at TIMESTAMP NULL,
        updated_at TIMESTAMP NULL
    );
    
  7. Posts Table:
    CREATE TABLE posts (
        id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
        user_id BIGINT UNSIGNED NOT NULL,
        title VARCHAR(255) NOT NULL,
        body TEXT NOT NULL,
        created_at TIMESTAMP NULL,
        updated_at TIMESTAMP NULL,
        FOREIGN KEY (user_id) REFERENCES users(id)
    );
    
  8. Pivot Table:
    CREATE TABLE role_user (
        user_id BIGINT UNSIGNED NOT NULL,
        role_id BIGINT UNSIGNED NOT NULL,
        PRIMARY KEY (user_id, role_id),
        FOREIGN KEY (user_id) REFERENCES users(id),
        FOREIGN KEY (role_id) REFERENCES roles(id)
    );
    
  9. Indexing Conventions:
    • Define primary key (e.g., PRIMARY KEY (id))
    • Index foreign keys (e.g., INDEX (user_id))
    • Unique indexes for unique columns (e.g., UNIQUE (email))
  10. Data Types Conventions:
    • BIGINT UNSIGNED for primary keys, INT UNSIGNED for foreign keys
    • VARCHAR(255) for variable-length strings, TEXT for longer texts
    • TIMESTAMP, nullable by default for optional timestamps
read more

Guide changing from MIUI to LineageOS on Redmi Note 10S

This guide will not take any responsibility of damage of one’s property.

Pre-requisites:

  1. Laptop/Desktop with USB 2.0 port (USB 3.0 is not supported i think)
  2. At-least 40% battery
  3. USB cable with data transfer capability
  4. Redmi Note 10S device

Software Required:

  1. Mi Unlock Tool
  2. ADB / Fastboot driver (device specific)
  3. Windows Command Prompt
  4. Mi Flash Tool

Pre-cautions:

Pre-Steps:

  1. Go to settings
  2. About Phone
  3. Tap 5 times on MIUI Version (It will enable developer option)
  4. Once developer option is enabled, go to Additional Settings and open developer options
  5. Toggle OEM unlocking and Add account in “Mi Unlock status” (It will use your data)
  6. Enable ADB debugging
  7. Add adb drivers for your device on your computer

Steps to unlock boot-loader:

  1. Ensure ADB is on
  2. Open the Mi Unlock Tool
  3. Login to your Mi Account linked with the device on the Mi Unlock Tool.It will start the process of verifying the account
  4. Now, it will show you the time required to unlock the boot-loader
  5. Wait till the time finishes
  6. Do same process from Step 1
  7. Then, it will lead to unlock button, upon clicking the button it will begin the process of unlocking the process of boot-loader unlock. It will format your device and get you back to base MIUI
  8. Congrats your boot-loader has unlocked and can flash custom OS or previous version of MIUI and mods into it

Steps to install Lineage OS:

  1. Downgrading to Android version 13
  2. Flashing Lineage OS recovery
  3. Flashing Lineage OS
  4. Optional: Flashing GAPPS

Steps to Downgrading to Android version 13

  1. Download the MIUI fastboot rom with android 13
  2. Open fastboot mode (Volume Down + Power) on your device and connect the device to your computer
  3. Open Mi Flash Tool and Select the downloaded rom
  4. After connection is successful then showing, select the device
  5. Click on flash button, it should now begin flashing the rom onto the device
  6. After the flashing is complete then the device might reboot

Steps to Flash Lineage OS Recovery

  1. Download the dtbo.img from Lineage OS page for this device
  2. Open fastboot mode (Volume Down + Power) on your device and connect the device to your computer
  3. Flash the downloaded dtbo.img file using the command
     fastboot flash dtbo dtbo.img
    
  4. You will now have flashed partitions required for lineage os
  5. Download the Lineage OS recovery image for the device boot.img
  6. Open fastboot mode (Volume Down + Power) on your device and connect the device to your computer
  7. Flash the downloaded recovery image onto your device using the command:
     fastboot flash boot boot.img
    
  8. Important: Now reboot your device into recovery mode using keys (Volume Up + Power)
  9. If you see the Lineage OS logo then you are booted into Lineage OS recovery, else you have to again flash the recovery.
read more

Quote from 10 Things I Hate About You

Mr. Morgan : All right… I assume everyone’s found time to complete their poem… except… for Mr. Donner.

[starts laughing]

Mr. Morgan : Who has an excuse

[laughs even harder, then stops]

Mr. Morgan : . Shaft! Lose the glasses.

[Joey removes his sunglasses, revealing his bruised nose from his earlier confrontation with Bianca]

Mr. Morgan : All right… anyone brave enough to read theirs aloud?

[Everyone looks at each other, waiting to see who goes first, Kat finally raises her hand]

Kat Stratford : I will.

Mr. Morgan : [rolls his eyes and sighs] Lord, here we go.

Kat Stratford : I hate the way you talk to me, and the way you cut your hair. I hate the way you drive my car. I hate it when you stare. I hate your big dumb combat boots, and the way you read my mind. I hate you so much it makes me sick; it even makes me rhyme.

[sighs]

Kat Stratford : I hate it, I hate the way you’re always right. I hate it when you lie. I hate it when you make me laugh, even worse when you make me cry.

[Kat’s voice breaks and she looks at Patrick]

Kat Stratford : I hate it when you’re not around, and the fact that you didn’t call.

[starts to cry]

Kat Stratford : But mostly I hate the way I don’t hate you. Not even close, not even a little bit, not even at all.

[Kat walks out the classroom]

read more

Welcome to Chandan Shakya's Blog

Welcome to all the readers to my first blog.

#include <stdio.h>
int main(void) {
    printf("Hello, World!\n");
    return 0;
}

Check out the Portfolio for my general portfolio.

Check out my GitHub for my repositories.

Check out my Twitter for things I post.

Check out my stackoverflow for my knowledge.

read more