Posts

Be 10x 10 tools from sessions

 gamma.app  create ppt paywallhub.com sci-hub.se ui.playground.ai  for creating images with prompt  app.yoodli.ai   for job search resume practice for your speech ChatGPT codedamn.com/ai    help to find out the bug in your code Gemini formula.dog creates the formula for Excel

Send email by Outlook in php Mailer

1. Enable Less Secure Apps Access (Not Recommended - Security Risk): Warning: This approach is generally not recommended due to security concerns. It allows access from any less secure app, including potentially malicious ones. Consider alternative methods (2 or 3) if possible. Sign in to your Microsoft account and navigate to Security Settings:  https://account.microsoft.com/account/manage-my-account Under "Advanced Security," select "Turn on two-step verification" (recommended for overall account security). Then, enable "Less secure apps" access ( use with caution ). 2. Use an App Password (Recommended): Generate an app password specifically for PHPMailer in your Microsoft account security settings. This password will be used in place of your regular Outlook password for enhanced security. 3. Configure PHPMailer: PHP <?php require 'vendor/autoload.php' ; // Assuming you have Composer installed use PHPMailer \ PHPMailer \ PHPMailer ; ...

Laravel Join with two coloums

 <?php namespace App\Http\Controllers; use App\Models\User; use Illuminate\Support\Facades\DB; class UserController extends Controller {     public function getUserOrders()     {         // Using Eloquent with inner join (default)         $usersWithOrders = User::join('orders', function ($join) {             $join->on('users.id', '=', 'orders.user_id');             $join->on('users.email', '=', 'orders.email'); // Additional join condition         })->get();         // Using DB facade with a more complex join (optional)         $complexJoin = DB::table('users')             ->select('users.id', 'users.name', 'orders.id as order_id', 'orders.product_id', 'orders.created_at')             ->join('orders', function ($join) {   ...

Second Highest Salary In SQL

 SELECT MAX(salary) AS second_highest_salary FROM employees WHERE salary < (   SELECT MAX(salary)   FROM employees ); select salary AS second_highest_salary  from emp order by desc limit 1,1 SELECT salary FROM (SELECT salary, ROW_NUMBER() OVER(ORDER BY salary DESC) as rank FROM `emp` ) emp where rank = 2; SELECT salary FROM (SELECT salary, DENSE_RANK() OVER(ORDER BY salary DESC) as rank FROM `emp` ) emp where rank = 2;

Add Css And Js Files on Specific Page In laravel

  1. Using Blade Layout Sections: Laravel's Blade templating engine provides a powerful way to manage layouts and include specific content on different pages. Here's how to achieve this: a. Base Layout ( layouts/app.blade.php ): <!DOCTYPE html> <html> <head> <title>My Website</title> @yield('page-css') <link rel="stylesheet" href="{{ asset('css/app.css') }}"> </head> <body> @include('partials.header') <main>@yield('content')</main> @include('partials.footer') @yield('page-js') <script src="{{ asset('js/app.js') }}"></script> </body> </html> b. Specific Page View ( views/home.blade.php ): @extends('layouts.app') @section('content')   @endsection @section('page-css')   <link rel="stylesheet" href="{{ asset('css/home.css') }}">  @endsection @se...

Diffrence between Put and Patch

PUT: Imagine you're replacing the entire contents of a document. With PUT, you send the complete updated version of the data to the server. It's like rewriting the whole document. PATCH: This is like editing specific parts of a document. You only send the changes you want to make, leaving the rest untouched. Example: Let's say you have a user profile with information like name, email, and phone number. PUT: If you want to update the entire profile with new data for all fields (name, email, phone), you'd use PUT and send the complete new user information. PATCH: If you only want to change the user's email address, you'd use PATCH and send just the updated email information. Here's the key difference: PUT: Replaces the entire resource. PATCH: Updates specific parts of a resource. 

Print Laravel Query Or Debug Laravel Query

Method 1:-  $posts = Post::where('id',' '> ,10)->toSql(); dd($posts); Method 2:- DB::enabLeQueryLog(); // Enable query tog $posts = Post::with('comments')->where('id',' '> ,10)->get(); dd(DB::getQueryLog()); // Show results of tog Method 3:- $posts = Post::with('comments')->where('id',' '> ,10)->get(); $comments = Comments::all(); DB::listen (function($query) { print_r(value: "DB:" . $query->sql ."[".implode(separator. " , " , $query->bindings) . "]"); });

Find Small number From array

 $numbers=array(12,23,45,20,5,6,34,17,9,56); $min = $numbers[0]; foreach ($numbers as $number) { if ($number<$min) { $min = $number; } } for($a=1; $a< count($numbers); $a++){  if ($numbers[$a]< $min) {   $min = $numbers[$a];  } } echo $min;

Credit Card Annual Fee Reversal Tricks

 Credit Card Annual Fee Reversal Tricks For Old Existing Users : Mail Format Below Subject : Request for Reversal of Credit Card Annual Fees And GST. Dear Sir/Ma’am, I hope this email finds you well. My name is [Your Name], and I am writing to request a reversal of the annual fees and GST charged on my credit card, [Last 4 digits of Credit Card Number in XXXX… 5678 format]. I have been a loyal customer for [X] years and have always appreciated the services provided by [Credit Card Issuer]. Recently, I have encountered [briefly explain any financial challenges or unforeseen circumstances you’ve faced]. Due to these circumstances, I am finding it challenging to manage my expenses, including the annual fees associated with my credit card. I understand that [Credit Card Issuer] has policies regarding fees, but I kindly request your consideration for a reversal or waiver in this particular situation. I have been diligent in maintaining a positive payment history and believe this request...

Drop Multiple Tables Query In Sql/Mysql

DROP TABLE `categories_194147308`, `categories_194147309`, `categories_194147310`, `categories_194147313`, `categories_194147354`, `categories_194147366`, `categories_194147381`, `categories_194147392`, `categories_194147408`, `categories_194147425`, `categories_194147426`, `categories_194147428`, `categories_194147567`, `categories_194147569`, `delivery_charges`; 

Create Table Query with Unique Key Constraints

 CREATE TABLE `table_name` (   `id` bigint(11) NOT NULL AUTO_INCREMENT,   `brand_id` int(11) DEFAULT 2,   `store_id` int(11) NOT NULL UNIQUE,   `merchant_id` int(11) NOT NULL UNIQUE,   `charges` text CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,   `created_at` datetime DEFAULT current_timestamp(),   `modified_at` datetime DEFAULT current_timestamp(),    PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Import Large files in all in one Migration

  Go to your WordPress root folder. Then find the .htaccess file there and put these codes in it. Then Go ahead and import part in your plugin. php_value upload_max_filesize 2048M php_value post_max_size 2048M php_value memory_limit 4096M php_value max_execution_time 0 php_value max_input_time 0

Calculate Factorial of a Number Without Loop In Php(Recursive Function)

 <?php     function factorial($n)     {         if ($n < 0)             return -1; /*Wrong value*/         if ($n == 0)             return 1; /*Terminating condition*/         return ($n * factorial ($n -1));     }         echo factorial(5);    ?>  

Woocommerce : Add Body class to product page if the current product is in the cart

 function ywp_check_product_is_in_cart( $product_id ) {     if ( ! WC()->cart->is_empty() ) {         foreach( WC()->cart->get_cart() as $cart_item ) {             $cart_item_ids = array( $cart_item['product_id'], $cart_item['variation_id'] );             if( in_array( $product_id, $cart_item_ids ) ) {                 return true;             }         }         return false;     }     return false; } add_filter( 'body_class', 'ywp_body_class_for_cart_items' ); function ywp_body_class_for_cart_items( $classes ) {     // Check user currently is in product page     if( ! is_singular( 'product' ) ) {         return $classes;     }     if( ywp_check_product_is_in_cart( get_the_id() ) ) {   ...

Understanding the Default WordPress .htaccess File: Functions and Configuration

The default WordPress .htaccess file is a crucial component of a WordPress site's configuration. This post delves into its significance, explaining its functions and how it influences site behavior. From handling permalinks to enhancing security, the .htaccess file plays a pivotal role in customizing site settings. This guide provides a comprehensive overview of the default directives in the WordPress .htaccess file and how they impact website performance. Whether you're a beginner seeking to grasp the basics or an experienced user looking for advanced customization tips, this post covers it all. Dive in to discover the power of the .htaccess file and learn how to leverage it for an optimized and secure WordPress site. # BEGIN WordPress RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress 

Exceeding Maximum Execution Time Error (30s)

 Increase the time limit As a last resort, you could temporarily extend the time limit, using either ini_set('max_execution_time', '300'); //300 seconds = 5 minutes or set_time_limit(300); In php.ini, like this: max_execution_time = 360; Maximum execution time of each script, in seconds (I CHANGED THIS VALUE) max_input_time = 120; Maximum amount of time each script may spend parsing request data ;max_input_nesting_level = 64; Maximum input variable nesting level memory_limit = 128M; Maximum amount of memory a script may consume (128MB by default)

Export commands in MySQL

 Use the mysqldump utility to export the database. The command is used as follows: mysqldump -uUSERNAME -p DB_NAME > exported.sql To export a specific table, you can use the following command: $ mysqldump -u USER_NAME -p DB_NAME table1 table2 > file_name To export multiple databases, you can use the following command: $ mysqldump -u USER_NAME -p ---databases DB_NAME1 DB_Name2 DB_Name3> file_name To prevent a table from being exported, use the following command: $ mysqldump -u USER_NAME -p DB_NAME --ignore-table=DB_NAME.TABLE_NAME > file_name

Setting up Virtual Hosts in XAMPP

Step 1) C:\WINDOWS\system32\drivers\etc\ Open the "hosts" file : 127.0.0.1       localhost 127.0.0.1       nownow.com 127.0.0.1       xpendy.in ::1             localhost Step 2) xampp\apache\conf\extra\httpd-vhosts.conf <VirtualHost *:80>     ServerAdmin admin@nownow.com     DocumentRoot "C:/xamppnew/htdocs"     ServerName nownow.com     ErrorLog "logs/nownow.com.log"     CustomLog "logs/nownow.com-access.log" common </VirtualHost> <VirtualHost *:80>     ServerAdmin admin@xpendy.in     DocumentRoot "C:/xamppnew/htdocs/xpendy"     ServerName xpendy.in     ErrorLog "logs/xpendy.in.log"     CustomLog "logs/xpendy.in-access.log" common </VirtualHost> Step 3) Restart XAMPP and now run :

Got a packet bigger than max_allowed_packet

 Also, change the my.cnf or my.ini file (usually found in /etc/mysql/) or(C:\xampp\mysql\bin\) under the mysqld section and set: max_allowed_packet=100M or you could run these commands in a MySQL console connected to that same server: set global net_buffer_length=1000000;  set global max_allowed_packet=1000000000;

PHP Artisan Tinker toolkit

 Provide us Intractive Shell For application by which we can make Opreations in Application # Craete,Update,Delete, Get and all coding things C:\xamppnew\htdocs\laravel>php artisan tinker Psy Shell v0.11.20 (PHP 8.2.4 — cli) by Justin Hileman > env('SESSION_DRIVER') = "file" > env('DB_CONNECTION') = "mysql" > User::all(): > User::create(['name'=>'test','email' => 'terst@gmail.com','password' => '123456']);