Posts

What is Short Polling

  Short polling is the simplest (and most "old-school") way for a client (like your web browser) to get updates from a server. In this model, the client repeatedly asks the server, "Do you have new data for me yet?" at fixed intervals (e.g., every 5 seconds). The server responds immediately, even if there is nothing new to report. How it Works Think of short polling like a kid in the backseat of a car on a road trip. Every two minutes, they ask, "Are we there yet?" * If the answer is No , the parent says "No" immediately. If the answer is Yes , the parent says "Yes." Either way, the kid waits another two minutes and asks the exact same question again. The Workflow Request: The client sends an HTTP request to the serve Immediate Response: The server checks its database or state. If there is new data , it sends it back (200 OK). If there is no data , it sends back an empty response (204 No Content or 200 OK with an empty list). Wait:...

Finding Your Redis Credentials: Host, Port, and Password

 Finding Your Redis Credentials: Host, Port, and Password Here is how to hunt down your Redis credentials in seconds. 1. The Host: Where is Redis living? In 90% of local development scenarios (including WSL), Redis lives right on your machine. Standard Local Host: 127.0.0.1 or localhost Remote Server: If you're connecting to a staging or production server, you will need that server's specific IP address or domain name (e.g., redis.example.com ). 2. The Port: Which door is open? The default port for Redis is 6379 . However, if you're running multiple instances, it might be different. To confirm exactly which port your instance is listening on, run: redis-cli CONFIG GET port Alternatively, you can ask your system which process is "squatting" on the network: sudo ss -tlnp | grep redis If you see 0.0.0.0:6379 , you're using the default. 3. The Password: Is the gate locked? By default, a fresh Redis installation has no password . In a local environment, this is ...

How to know Redis is installed or not in WSL

How to Check if Redis is Installed on WSL (and How to Fix It) If you're developing on Windows, using Redis inside Windows Subsystem for Linux (WSL) is the gold standard for performance. But sometimes, it’s hard to tell if you already have it set up or if the service is just sleeping. Here is a quick guide to verifying your Redis installation and getting it running in seconds. Phase 1: The "Quick Check" Before digging into system logs, try these two commands to see if Redis is already in your path. 1. Check the Version redis-server --version Success: You’ll see Redis server v=7.x.x . Failure: You’ll see command not found . 2. Locate the Binary which redis-server This tells you exactly where the executable lives (usually /usr/bin/redis-server ). If it returns nothing, Redis likely isn't installed. Phase 2: Verifying via Package Manager If the commands above failed, it’s possible the package is there but not in your environment path. Check the dpkg database: dpkg -...

How to install Tesseract in WSL

Image
 Hi, In this post, we will see how to use tesseract ocr in wsl and use. Install Tesseract OCR: sudo apt install tesseract-ocr -y Install Language packes: Since my project needs both English and Tamil support: # English (usually included by default, but explicit is safer) sudo apt install tesseract-ocr-eng -y # Tamil language pack sudo apt install tesseract-ocr-tam -y Verify Installation # Check Tesseract version tesseract --version # List installed languages tesseract --list-langs

How to fix Cannot start Docker Compose application

 Hi Everyone, Today, lets see how to solve the below issue while starting the docker containers. Cannot start Docker Compose application. Reason: compose [start] exit status 1. Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? Steps to  Fix : 1 . Open  Docker  Desktop  Settings Click the  Docker Desktop icon  in system tray  → Settings  (gear icon) 2. Enable W SL  2 Backend Go to  General  tab Check   "Use the W SL 2  based engine " Click   Apply  & Restart 3 . Enable WSL  Integration Go  to  Resources  →  WSL Integration Turn on  "Enable integration  with  my  default W SL  distro " Or manually enable  your specific  distro from  the  list Click   Apply & Restart

How to access domain url inside WSL

Image
I use WSL (Windows Subsystem for Linux) for my application development. When I run my application inside WSL, I can access it from the Windows browser using: http://localhost:4000 This works perfectly without any issues. However, when I try to open the domain-based URL like: http://abc.localtest.me:4000 it does not open in the Windows browser. How I Solved This To fix this issue, I decided to install and run Firefox directly inside WSL . Since I’m using Windows 11 with WSLg enabled , GUI applications from WSL can open directly on the Windows desktop without any extra configuration. Step 1: Install Firefox in WSL Open your WSL terminal (Ubuntu or any other distro you’re using) and run: sudo apt update sudo apt install firefox -y Step 2: Launch Firefox After installation, simply run: firefox Now you can see the firefox will open with linux icon In firefox browser you can open the domain url of WSL. Thank you!!

Rules file for modular application development

You are building a modular, maintainable application. Follow these rules strictly for all code in this project. ARCHITECTURE - Use a modular, feature-based architecture. - One module represents one business capability. - Do NOT create large monolithic files. - If a file exceeds ~300 lines, it must be split. MODULE STRUCTURE Each feature module MUST follow this structure: modules/<module-name>/   - <module>.routes.js      → HTTP routes only   - <module>.controller.js  → Request/response handling only   - <module>.service.js     → Business logic only   - <module>.repository.js  → Database access only (Knex)   - <module>.validator.js   → Input validation   - <module>.errors.js      → Module-specific errors   - index.js                → Expose only routes SEPARATION OF CONCERNS - Routes MUST NOT contain business...