Posts

Solving 'rm -rf Cannot Remove Directory: Directory Not Empty' in Linux

Image
  hasindu@hasindu-inspiron:/media/hasindu/Disk_D/Y3S2/DS/Labs$ rm -rf Socket_Programming_Lab rm: cannot remove 'Socket_Programming_Lab/chatserver/.metadata/.plugins/org.eclipse.m2e.logback': Directory not empty hasindu@hasindu-inspiron:/media/hasindu/Disk_D/Y3S2/DS/Labs$ sudo rm -rf Socket_Programming_Lab rm: cannot remove 'Socket_Programming_Lab/chatserver/.metadata/.plugins/org.eclipse.m2e.logback': Directory not empty hasindu@hasindu-inspiron:/media/hasindu/Disk_D/Y3S2/DS/Labs$ lsof +D Socket_Programming_Lab COMMAND    PID    USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME nautilus  9316 hasindu   30r   DIR    8,1        0 1122807 Socket_Programming_Lab nautilus  9316 hasindu   36r   DIR    8,1        0 1122808 Socket_Programming_Lab/chatserver nautilus  9316 hasindu   38r   DIR    8,1...

Study React 18 features

 https://youtu.be/sjgA23G-TXU?si=xvLfUlzkNFWC3b50 full video for full stack https://youtu.be/ZxKM3DCV2kE?si=a1RIDL-NRGtVgfBk

RBAC for DS UBER app

 https://chatgpt.com/c/67ecfa5a-7d1c-8012-831d-436f0d0e4627 Usage of context for auth AuthContext

Compare DOM Manipulation VanillaJS vs React vs VueJS

Image
  DOM Manipulation: React vs Others

Add linux app to ubuntu

 When you run flutter build linux , Flutter generates the build files inside the build/linux directory of your project. Here’s the typical directory structure: reminder-app/ ├── build/ │   ├── linux/ │   │   ├── x64/ │   │   │   ├── release/   <-- This contains the built binary and other necessary files │   │   ├── debug/ │   │   ├── intermediate/ │   ├── ... ├── linux/   <-- Contains CMake-related build configuration ├── lib/ ├── ... Install System-Wide (Optional) 1️⃣ Create the Directory in /opt/ Run the following command to create the directory for your app: bash Copy Edit sudo mkdir -p /opt/reminder-app 2️⃣ Copy the Files Again Now, copy all the files from the bundle folder to /opt/reminder-app/ : bash Copy Edit sudo cp -r build/linux/x64/release/bundle/* /opt/reminder-app/ 3️⃣ Set the LD_LIBRARY_PATH Create a launcher script to set...

Assign a delivery to the nearest available driver

 Great — you already have clean Mongoose models! To assign a delivery to the nearest available driver , you'll implement a geo-based query on the Driver collection to find a driver close to the restaurant’s location and available. ✅ Step-by-Step Logic 1. Get the Restaurant Location From the Restaurant model: js Copy Edit const restaurant = await Restaurant . findById (restaurantId); const { lat, lng } = restaurant. address . coordinates ; 2. Find the Nearest Available Driver You can use MongoDB's geoNear feature if you convert currentLocation into a 2dsphere index : 🛠 Modify Driver model: js Copy Edit driverSchema. index ({ currentLocation : "2dsphere" }); ✅ This lets MongoDB understand lat/lng for spatial queries. 3. Query for Nearby Available Drivers js Copy Edit const nearbyDrivers = await Driver . find ({ status : 'available' , currentLocation : { $near : { $geometry : { type : "Point" , co...

How to Save Notifications in the Database in Laravel

  How to Save Notifications in the Database in Laravel Laravel provides a built-in way to store notifications in the database using the database channel. Here’s how you can set it up. 1. Create the Notifications Table Laravel comes with a built-in migration for notifications. If you haven’t migrated it yet, run: php artisan notifications:table php artisan migrate This will create a notifications table in your database with fields like: id (unique identifier) type (notification class) notifiable_id & notifiable_type (user or model that received the notification) data (JSON field storing notification details) read_at (timestamp for when the notification is read) 2. Update Your Notification Class Modify your CommentAddedNotification to use the database channel and store data. Example: app/Notifications/CommentAddedNotification.php namespace App \ Notifications ; use Illuminate \ Bus \ Queueable ; use Illuminate \ Contracts \ Queue \ ShouldQueue ; us...