Posts

Callback Function Simple Explaination

Image
Callback Function A callback function is a function that you pass into another function , so it can be called later when something happens. Human example: You order food at a restaurant. You tell the waiter: “When my food is ready, call me.” Here, calling you later is like a callback. In programming: function cookFood(callback) { console.log("Cooking food..."); callback(); } function tellCustomer() { console.log("Your food is ready!"); } cookFood(tellCustomer); Output: Cooking food... Your food is ready! Here, tellCustomer is the callback function. Because we pass it into cookFood(tellCustomer) . Then cookFood runs it later using callback(); Another common example: setTimeout(function () { console.log("This runs after 2 seconds"); }, 2000); Here, the function inside set...

DAY 01 - SQL QUERIES

  Question You have a table called orders: orders(order_id, user_id, amount, order_date) Write an SQL query to find all users who have placed at least one order greater than the average order amount. Answer SELECT user_id FROM orders WHERE amount > (     SELECT AVG(amount)     FROM orders ); To avoid duplicate users: SELECT DISTINCT user_id FROM orders WHERE amount > (     SELECT AVG(amount)     FROM orders ); Explanation: Inner query calculates the average order amount first, then the outer query finds users with orders above that average.

How to setup laravel app without installing composer and php

 refer this url https://chatgpt.com/share/69f82535-54a0-83a2-96e6-3356b5110bd7 Docker first laravel setup

How to Search Files Quickly in Windows Using PowerShell

🔍 Search Files Quickly Using PowerShell Use this command to quickly find files in your system: Get-ChildItem -Path $env:USERPROFILE -Recurse -Include *minitab* -File -ErrorAction SilentlyContinue Example Output: Directory: C:\Users\Hasindu\Documents\minitab-setup[1] Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 4/9/2025 10:04 PM 66304517 minitab-setup.exe

How to Check for NVIDIA GPU and Set It Up in Ubuntu

Image
If you want to run deep learning models or GPU-accelerated tasks on Ubuntu, having an NVIDIA GPU and the correct drivers is essential. This guide will help you check if a GPU is available and set it up properly for PyTorch. 1 Check if your system has an NVIDIA GPU Open a terminal and run: lspci | grep -i nvidia ✅ If output appears , your system has an NVIDIA GPU. 0000:01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce MX350] (rev a1) ❌ If no output , your system either doesn't have a GPU or it's disabled in BIOS. 💡 Tip: Take note of your GPU model. You'll need it to choose the correct driver. 2 Check if NVIDIA drivers are installed Run: nvidia-smi ✅ If working , you will see a table with GPU info, driver version, and CUDA version: +-----------------------------------------------------------------------------+ | N...

Linux Commands

Linux Commands Cheat Sheet Linux Commands Cheat Sheet Essential commands for developers and system administrators This comprehensive cheat sheet covers the most commonly used Linux commands for file management, system administration, networking, and more. 📁 File & Directory Commands Navigation pwd Show current directory ls List files ls -l List with details ls -a Include hid...

use TLS in laravel

refer these https://laravel.com/docs/12.x/valet#securing-sites https://cpriego.github.io/valet-linux/requirements