Posts

Win 11 : show missing power plans

Method 1: Powershell Command powercfg -restoredefaultschemes 2. Alternate Method CMD Command  powercfg /s SCHEME_MIN 3.  Alternate Method CMD Commands : [High Performance] powercfg -duplicatescheme 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c [Balanced] powercfg -duplicatescheme 381b4222-f694-41f0-9685-ff5bb260df2e [Power Saver] powercfg -duplicatescheme a1841308-3541-4fab-bc81-f71556f20b4a [Ultimate Performance] powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61

Temporary Workaround for cURL DNS Resolution Failure Using CURLOPT_RESOLVE

 Temporary Workaround for cURL DNS Resolution Failure Using CURLOPT_RESOLVE ========================================================================== If you're using PHP's cURL functions and encounter the dreaded error: ``` cURL Error: Could not resolve host: example.com cURL Error Code: 6 ``` It means your server is **unable to resolve the domain name to an IP address** — usually a DNS issue. While fixing your DNS configuration is ideal, sometimes you need an **immediate workaround** — especially in production or during development. The Workaround: CURLOPT_RESOLVE ------------------------------- PHP’s cURL supports a powerful option called `CURLOPT_RESOLVE`. It allows you to **manually specify the IP address** for a domain, bypassing DNS resolution altogether. ### Basic Syntax ```php curl_setopt($ch, CURLOPT_RESOLVE, ['example.com:443:93.184.216.34']); ``` - `example.com` → domain name you’re accessing - `443` → port number (use `80` for HTTP or `443` for HTTPS) - `93...

JavaScript Password Strength Checker

JavaScript Password Strength Checker  document.addEventListener("DOMContentLoaded", function () {     const passwordInput = document.getElementById("password");     const strengthContainer = document.getElementById("oneid-password-strength-container");     passwordInput.addEventListener("input", function () {         const strength = checkPasswordStrength(passwordInput.value);         strengthContainer.textContent = `Strength: ${strength}`;         updateStrengthColor(strengthContainer, strength);     });     function checkPasswordStrength(password) {         let strength = 0;         if (password.length >= 8) strength++;         if (/[A-Z]/.test(password)) strength++;     ...

Hosting a Laravel 11 project on cPanel shared hosting

  Hosting a Laravel 11 project on cPanel shared hosting involves several steps since Laravel is built to work with a virtual host setup (like localhost with public/ as root), but cPanel typically uses public_html/ as the root directory. Here’s a full guide to help you: ✅ Prerequisites Laravel 11 project ready on your local machine. cPanel access (via your hosting provider). PHP version on server must be PHP 8.2+ . Composer installed on server (optional but helpful). MySQL database (if needed) created in cPanel. 📁 Step-by-Step Hosting Guide 1. Structure Your Project for cPanel By default, Laravel uses public/ as the web root. But cPanel uses public_html/ . So you need to move the contents of Laravel's public/ folder into public_html/ , and update paths accordingly. Let’s say your project folder is called laravel11app . Option A: Simple Adjustment (Recommended for shared hosting) Compress your entire Laravel project , excluding the vendor folder (optiona...

fixHTML

 <?php function fixHTML($html) {     libxml_use_internal_errors(true);     $doc = new DOMDocument();     $doc->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);     libxml_clear_errors();     return $doc->saveHTML(); }  ?> ---------------------------------------------------------------------- <? = fixHTML ( htmlspecialchars_decode ( stripslashes ( $a [ 'body' ]))) ?>

Battery report using cmd

 powercfg /batteryreport    

php - get vimeo video id from url

 function getVimeoVideoIdFromUrl($url = '') {     $regs = array();     $id = '';     if (preg_match('%^https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\#?)(?:[?]?.*)$%im', $url, $regs)) {         $id =   $regs[3];     } //    else //    { //        $id = substr($url,10,strlen($url)); //    }     return $id; }