Sunday 19 December 2021

Forgot / Change / reset your Windows 10 password

 Reset your Windows 10 local account password

  1. Manually power-off system 3 times ( illegal shut down - press the power button)
  2. Power on - You can see "  Preparing Automatic Repair "
  3. Go to Advanced Option on the screen
  4. Click on Troubleshoot Option
  5. Go to Advanced Option on the screen
  6. Go to System Image Recovery  on the screen
  7. On popup " Cancel "  then " Next "
  8. Click to Advanced button  ==> Install a driver  ==> click " OK "
  9. It will open a popup file browser windows/system32 folder
  10. Find the file  Utilman  and rename it to utimanold , refresh, then rename file " cmd "  to Utilman
  11. Close close ( cancel cancel ) popups and then " choose an option Continue "
  12. After restart ->on bottom right corner you can see second icon " Ease of access " , it will open command prompt
  13. c:/windows/system32
  14.  Type " net user "  and enter , you can see a list administrator , users in the system
  15. Type " net user user *   "  ( where second user is the username for laptop) and enter
  16. close then click arrow icon of login

Friday 26 November 2021

connect to Linux by name instead of ip address

 connect to linux by name instead of ip address

Go to ~/.ssh/config

Host dev
  HostName XXX.XX.XX.XXXX
  IdentityFile ~/.ssh/id_rsa
  User xxxxxxxxxxxx
  AddKeysToAgent yes

Monday 19 July 2021

Search and Replace For a Text String in wordpress posts

 

Search and Replace For a Text String

UPDATE wp_posts SET post_content = REPLACE (  post_content,  'text to find here',  'text to replace here');

Monday 12 July 2021

Turn off caching using .htaccess

Disabling caching

Add this code at the bottom of the .htaccess file to turn off caching. Delete the code to turn caching on again.

# DISABLE CACHING
<IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires 0
</IfModule>

<FilesMatch "\.(css|flv|gif|htm|html|ico|jpe|jpeg|jpg|js|mp3|mp4|png|pdf|php|txt)$">
    <IfModule mod_expires.c>
        ExpiresActive Off
    </IfModule>
    <IfModule mod_headers.c>
        FileETag None
        Header unset ETag
        Header unset Pragma
        Header unset Cache-Control
        Header unset Last-Modified
        Header set Pragma "no-cache"
        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
        Header set Expires "Thu, 1 Jan 1970 00:00:00 GMT"
    </IfModule>
</FilesMatch>

Monday 21 June 2021

Get Last Executed Query in Laravel

 Last Query in Laravel

DB::enableQueryLog();
$product = Product::get();
$query = DB::getQueryLog();
dd($query);
  1. \DB::enableQueryLog();
  2. $list = \DB::table("categories")->get();
  3. $query = \DB::getQueryLog();
  4. print_r(end($query));