Highlight Reel

Navigaton
  1. LIVEBOLIVAR.COM
  2. Buy a new PC.
  3. How many bytes / files have I written / created? Go to https://dfellows.rf.gd/fileSizeCountRecursive.php
  4. Current weather page.
  5. How to query api.weather.gov, forecast.weather.gov and ipgeolocation.io and display weather and astronomical json data using Windows, PHP and Javascript. Crop and resize image with PHP and GD Library.
  6. Edit image with HTML, PHP, PHP GD Library, Javascript and https://dfellows.rf.gd/site_html/processImageJPG.php
  7. My youtube channel
    1. my youtube channel
    2. LAPTOP SCREEN REPLACEMENT / HOW TO REPLACE LAPTOP SCREEN HP PAVILION DV2000
    3. REPAIR 2000 NISSAN SENTRA CRUISE CONTROL SWITCH
    4. REPLACE DRILL CHUCK
  8. Phone: Google Pixel 6a 2022. 6GB RAM. 128gb Storage. 4410mAh. 412x915. 252dpi. USB-C. Google Tensor (5 nm) Octa-core (2x2.80 GHz Cortex-X1 & 2x2.25 GHz Cortex-A76 & 4x1.80 GHz Cortex-A55). Android 14. Dual-band Wi-Fi 802.11 a/b/g/n/ac/6e, Wi-Fi Direct. Speakers.
  9. Laptop: Windows 10 Home 64-bit. 2015 HP 15-AF152NR 15-Series Notebook, AMD A8-7410 Quad-Core, 2.2 GHz, 8GB, 1 TB, Touch AMD Radeon R5 graphics, 2.4 GHz 802.11n, 3-cell, 31 Wh Li-ion polymer.
  10. Desktop: Windows 10 Pro 64-bit. i5-7500 @ 3.4GHz, 24GB, EVGA GeForce GTX 1050 Ti 4GB, 1TB.
  11. Server: Windows 10 Pro 64-bit. i3 @ 3.4GHz, 8GB, Radeon R7 200 Series 2GB, 1TB x 2.
  12. My device info.
  13. SEE TO DO BELOW
  14. infrastructure, isp, hosting, web development and design.
  15. !!! its always the cdn cache !!!
  16. Upload site_html/readme18_files/*.jpg
  17. WHAT RIGHTS DOES EACH SHORTCUT / PROCESS / COMMAND / PROGRAM / window HAVE?
  18. I taught myself windows 3.11 through 10, Linux, Html5, CSS3, javascript, php 5.3, Git, Node, Sass, Compass, Susy, Breakpoint, Gulp, APACHE configuration through .htaccess, Dreamweaver AND Paint Shop Pro.
  19. I would like to learn POWERSHELL 5, php 7, windows server, Apache httpd.conf, MySQL, raspberry pI as a web/ftp/email/dns server and Photoshop. I would like to learn more of what I already know except for DreamWeaver and Paint Shop Pro.
  20. MY BATCH FILE TO SECURE AND BACKUP WIN10 PRO 64-BIT THROUGH WINDOWS XP HOME 32-BIT
    1. LOGFILE PRODUCED BY _61.BAT - REDACTED
    2. WINDOWS 10 SCHEDULED TASK I BUILT AROUND _61.BAT.
    3. Wannacry protection using
      1. _rename3.bat
        1. bulk double click name / rename files.
    4. SECURE SENSITIVE INFORMATION WITH PASSWORD PROTECTED 7Z AND SELF-DECRYPTING PASSWORD PROTECTED PGP FILE.
    5. WINSCP.COM
      1. ONLINE STORAGE by list, drag and drop, or send to with no user input
  21. iNSTALL WINDOWS
    1. iNSTALL WINDOWS NOTES
    2. dial-in windows batch - redacted
    3. my registry tweakS
  22. my first attempt at php programming
    1. itunes0.php
      1. i wanted to put my itunes v9 playlist into a html document.
  23. weather.php
  24. export ie11 BOOKMARKS, COOKIES, AND FEEDS with JITBIT macro recorder
    1. macro
  25. export edge favorites with emmet grey's edge manage and JITBIT macro recorder
    1. macro
  26. USING MIXED "@media screen" AND "@media only SCREEN" IN MY CSS CAUSED THE CSS TO FAIL. USE ONE OR THE OTHER.
  27. style YOUR DIRECTORY LISTING WITH .index.php and .HTACCESS or header.html and .HTACCESS.
    1. Live example
    2. SEE CSS-TRICKS
      SCREENSHOT OF DIRECTORY STYLING WITH JAVASCRIPT FROM CSS-TRICKS
    3. SEE perishablepress
    4. custom directory listing with htaccess private folder at dfellows.rf.gd screenshot
  28. radio.php
    1. i take no credit for this i just like it. it uses a javascript audio library to listen to streaming audio.

  29. HTML/CSS (Top)
    1. Improperly commented html/php killed my page online but not in localhost
      1. Killer code:
        1. <!-- replace 102720 with this <?php// echo date("mdy")?> -->
      2. Found error message in View Source. No message in dev tools.
      3. Page stopped loading at error so I had no navigation menu.
        1. Fatal error: Uncaught Error: Undefined constant "php" in /home/vol8_4/epizy.com/epiz_25054752/htdocs/site_html/readme18.php:51 Stack trace: #0 {main} thrown in /home/vol8_4/epizy.com/epiz_25054752/htdocs/site_html/readme18.php on line 51
    2. User-Agent from NOAA weather Grabber
      define( 'SCRIPT_VERSION', '3.1.0' );define( 'WEBSITE_URL', 'http://dfellows.rf.gd' );define( 'EMAIL_ADDRESS', 'dfellows@juno.com' );"User-Agent: Current NOAA Weather Grabber/v" . SCRIPT_VERSION . ". (" . WEBSITE_URL . "; " . EMAIL_ADDRESS . ")\r\n"
    3. Reload page once when focus is restoredReload page once when focus is restored.See 42.PHP and the link to the log page. This eliminates the need to refresh a page by using the refresh button. I can see if 42.php is working, see if it has altered the log as soon as I switch to the log page without having to use the refresh button. Install this code in the log page.
      <script type="text/javascript">window.onblur= function() {window.onfocus= function () {location.reload(true)}};</script>
    4. This code in images\.htaccess broke localhost\readme18.php images\dfellows.rf.gd980x275.jpg . Returned error 500
      1. <FilesMatch "weather-seven-day-forecast-graphic.*.jpg$">  ExpiresByType image/jpeg "modification plus 86400 seconds"</FilesMatch>
      2. <FilesMatch "weather-seven-day-forecast-graphic.*.jpg$">ExpiresByType image/jpeg "modification plus 86400 seconds"</FilesMatch>
    5. HTML Entity List
      1. Complete list of HTML entities with their numbers and names.
        1. & &amp; Ampersand
          < &lt; Less-than
          > &gt; Greater than
    6. style <code> with highlight.js and highlight.css
    7. I use a coding technique to help debug code. I put "AROUND LINE xxxx" and "LINE XXXX" IN THE CODE. As code is added / deleted / modified line numbers change.. My powershell script re-numbers "AROUND LINE xxxx" and "LINE XXXX".
    8. embed graphics with base64 encoding. See %windows2%\_codepart1.html, %windows2%\_last100part1.html. If you have a Windows desktop you can see the results at site_html/_last100.html

  30. PHP (Top)
    1. Date format
    2. Retrieve detailedForecast "Mostly clear, with a low around 53 ...." with your zipcode from the NWS.

      Retrieve detailedForecast "Mostly clear, with a low around 53 ...." with your zipcode from the NWS.


      ChatGPT

      function get_nws_forecast($zip_code) { // NWS API URL for a given ZIP code $url = "https://api.weather.gov/points/44.7369,-85.5797"; // Coordinates for 49686 // https://api.weather.gov/gridpoints/APX/30,45/forecast // Initialize cURL session $ch = curl_init(); // Set cURL options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" ]); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Execute cURL session and get the response $response = curl_exec($ch); // Check for errors if(curl_errno($ch)) { echo 'Error:' . curl_error($ch); return null; } // Close cURL session curl_close($ch); // Decode JSON response to get forecast URL $data = json_decode($response, true); if (isset($data['properties']['forecast'])) { $forecast_url = $data['properties']['forecast']; // Fetch forecast data $forecast_response = file_get_contents($forecast_url); $forecast_data = json_decode($forecast_response, true); // return $forecast_data; return array($forecast_data, $forecast_url); } else { return null; } } list($forecast_data, $forecast_url) = get_nws_forecast("49686"); echo '<br>The forecast url is '.$forecast_url.'<br>'; print_r($forecast_data);
    3. file size recursive - file size scripts. How many characters have you written / created / produced?
      1. 
        
        
        <?php
        // NOT USING SKIP_DOTS ADDS ~4,000,000 BYTES TO $bytestotal?
        function scan_dir($path){
            $ite=new RecursiveDirectoryIterator($path,RecursiveDirectoryIterator::SKIP_DOTS);
        
            $bytestotal=0;
            $nbfiles=0;
            foreach (new RecursiveIteratorIterator($ite) as $filename=>$cur) {
                $filesize=$cur->getSize();
                $bytestotal+=$filesize;
                $nbfiles++;
                $files[] = $filename;
            }
        
            $bytestotal=number_format($bytestotal);
        
            return array('total_files'=>$nbfiles,'total_size'=>$bytestotal,'files'=>$files);
        }
        
        $files = scan_dir('./');
        $a = count(glob('*/*', GLOB_ONLYDIR));
        echo $a." folders. {$files['total_files']} files for {$files['total_size']} bytes<br />";
        
        echo 'HTML = '.count(glob("*/*.html")).'<br />';
        echo 'CSS = '.count(glob("*/*.css")).'<br />'; 
        echo 'PHP = '.count(glob("*/*.php")).'<br />'; 
        echo 'JS = '.count(glob("*/*.js")).'<br />'; 
        echo 'JPG = '.count(glob("*/*.jpg")).'<br />'; 
        echo 'PNG = '.count(glob("*/*.png")).'<br />'; 
        echo 'PSP = '.count(glob("*/*.psp")).'<br />'; 
        echo 'GIF = '.count(glob("*/*.gif")).'<br />'; 
        echo 'ICO = '.count(glob("*/*.ico")).'<br />'; 
        echo 'TXT = '.count(glob("*/*.txt")).'<br />'; 
        echo 'Video count: '.count(glob("*/*.{mp4,mov,wmv,webm,avi,flv,mkv,mts}",GLOB_BRACE)).'<br />';
        echo 'File count: '.count(glob("*/*.{html,php,css,jpg,jpeg,png,psp,gif,ico,txt,js}",GLOB_BRACE)).'<br />';
        
        /* 
        file size recursive - file size scripts. 
        How many characters have you written / created / produced?
        Save in root directory. 
        */
        
        $size='0';
        $totalSize='0';
        $fileSizeScripts='0';
        $fileSizeScripts2='0';
        $fileSizeImages='0';
        
        $di = new RecursiveDirectoryIterator('.');
        foreach (new RecursiveIteratorIterator($di) as $filename => $file) {
           if($file->isFile()) {
                //echo $filename . ' - ' . $file->getSize() . ' bytes <br/>';
                $totalSize += $file->getSize();
            }
        }
        
        
        
        $di = new RecursiveDirectoryIterator('scripts/.');
        foreach (new RecursiveIteratorIterator($di) as $filename => $file) {
           if($file->isFile()) {
                //echo $filename . ' - ' . $file->getSize() . ' bytes <br/>';
                $fileSizeScripts += $file->getSize();
            }
        }
        
        $di = new RecursiveDirectoryIterator('resume/livebolivar/scripts/.');
        foreach (new RecursiveIteratorIterator($di) as $filename => $file) {
           if($file->isFile()) {
                //echo $filename . ' - ' . $file->getSize() . ' bytes <br/>';
                $fileSizeScripts2 += $file->getSize();
            }
        }
        
        $z = sprintf("%09d", $fileSizeScripts); $z += sprintf("%09d", $fileSizeScripts2);
        // $z = str_split($z, strlen($totalSize)-strlen($fileSizeScripts));$z = implode(",",$z); // Add X leading zero
        echo number_format($fileSizeScripts+$fileSizeScripts2).' bytes in scripts folders.<br />';
        echo 'I wrote / created '.number_format($totalSize-($fileSizeScripts+$fileSizeScripts2)).' characters that create my website.<br />';
        echo 'War and Peace contains ~3,000,000 characters.<br />';
        echo 'I wrote / created '.(100-($z/$totalSize)*100).'% of the characters that create my website.';
        
        
        
        ?>
        
        
        
    4. How often should i use `clearstatcache()`

      How often should i use `clearstatcache()`


      User

      how often should i use `clearstatcache();`


      ChatGPT

      In PHP, the `clearstatcache()` function is used to clear the file status cache. This cache is used to store information about files, such as their size, modification time, and other file attributes, to improve performance by reducing the need to repeatedly query the filesystem. You should use `clearstatcache()` in the following situations: 1. **After Modifying a File**: If your script performs operations that change the state of a file (such as writing to it, changing its permissions, or deleting it), and you need to immediately get the updated file status, you should call `clearstatcache()`. For example: ```php file_put_contents('example.txt', 'New content'); clearstatcache(); $fileSize = filesize('example.txt'); // Ensures you get the updated file size ``` 2. **After Multiple File Operations**: If your script is performing a series of file operations and relies on up-to-date file information between operations, using `clearstatcache()` ensures that the file information is current. 3. **When Checking File Existence**: If your script creates a new file or deletes an existing one and immediately checks for its existence using functions like `file_exists()`, calling `clearstatcache()` can ensure that the check reflects the most recent state. 4. **When Working with File Metadata**: If your script updates file metadata (like modification time or permissions) and needs to fetch the latest metadata right after the update, you should call `clearstatcache()`. ### Example Usage Here’s an example scenario where `clearstatcache()` is necessary: ```php $file = 'example.txt'; // Check initial file size $initialSize = filesize($file); // Write new content to the file file_put_contents($file, 'New content'); // Clear the cache to ensure we get the updated file status clearstatcache(); // Get the updated file size $updatedSize = filesize($file); // Output the sizes echo "Initial size: $initialSize bytes, Updated size: $updatedSize bytes"; ``` In this example, without calling `clearstatcache()`, the `filesize()` function might return the old size of the file because the file status information could still be cached. ### General Guideline - **Use it when necessary**: Only use `clearstatcache()` when you have a specific need to refresh the file status information. Overusing it can negate the performance benefits of caching. - **Performance considerations**: Avoid calling `clearstatcache()` excessively in performance-critical sections of your code, as it can introduce unnecessary overhead. In summary, use `clearstatcache()` judiciously to ensure your script works with the most up-to-date file information when necessary.


      User

      is `file_exist` cached?


      ChatGPT

      Yes, the `file_exists()` function in PHP does utilize the file status cache. When you use `file_exists()` to check for the presence of a file, PHP may cache the result to improve performance, avoiding repeated and potentially expensive filesystem queries. ### When to Use `clearstatcache()` Given that `file_exists()` can return cached results, you should use `clearstatcache()` in the following scenarios to ensure that you are working with the most current file information: 1. **After Creating a File**: If your script creates a new file and you need to immediately check for its existence, calling `clearstatcache()` ensures that `file_exists()` will see the new file. ```php touch('example.txt'); // Create a new file clearstatcache(); if (file_exists('example.txt')) { echo 'File exists!'; } ``` 2. **After Deleting a File**: If your script deletes a file and you need to verify its non-existence right after, use `clearstatcache()` to ensure the cache is cleared. ```php unlink('example.txt'); // Delete the file clearstatcache(); if (!file_exists('example.txt')) { echo 'File does not exist!'; } ``` 3. **After Modifying File Metadata**: If file metadata is changed (e.g., permissions, owner), and you need to check the file's status right after, `clearstatcache()` can be used to get updated information. ### Example Usage Here is a practical example demonstrating the need to clear the cache: ```php $file = 'example.txt'; if (!file_exists($file)) { // Create the file if it doesn't exist file_put_contents($file, 'Sample content'); // Clear the file status cache to ensure subsequent checks reflect the current state clearstatcache(); } if (file_exists($file)) { echo 'The file now exists!'; } else { echo 'The file still does not exist!'; } ``` ### Summary - `file_exists()` is subject to caching in PHP to optimize performance. - Use `clearstatcache()` when you need to ensure that `file_exists()` and other file status functions reflect the current state of the filesystem, especially after file operations like creation, deletion, or metadata changes. - Apply `clearstatcache()` judiciously to balance the need for accurate file status information with the performance benefits of caching.


      User

      `file_exists`caches what information


      ChatGPT

      The `file_exists()` function in PHP checks whether a file or directory exists. The caching mechanism in PHP affects this function in terms of file status information. Here’s a detailed look at what information is cached and how it impacts `file_exists()`: ### Cached Information 1. **File Existence**: The result of whether a file or directory exists at a given path. 2. **File Metadata**: Basic file metadata, such as file size, modification time, and permissions, can be cached by the underlying filesystem. ### Impact on `file_exists()` When you call `file_exists()`, PHP may cache the result of this function to avoid repeated system calls, which can be expensive in terms of performance. This means if you create, delete, or modify a file, subsequent calls to `file_exists()` might return outdated information unless the cache is cleared. ### Clearing the Cache To ensure that `file_exists()` always returns the most current information, you can use the `clearstatcache()` function. This function clears the file status cache, ensuring that subsequent calls to `file_exists()` (and other file status functions) fetch fresh information from the filesystem. ### Examples #### Example Without Cache Clearing ```php <?php // Initially check if the file exists if (!file_exists('example.txt')) { // Create the file touch('example.txt'); // Check again without clearing the cache if (file_exists('example.txt')) { echo 'File exists! (This may or may not print without clearing the cache)'; } } ?> ``` #### Example With Cache Clearing ```php <?php // Initially check if the file exists if (!file_exists('example.txt')) { // Create the file touch('example.txt'); // Clear the cache to ensure the next check is accurate clearstatcache(); // Check again with cache cleared if (file_exists('example.txt')) { echo 'File exists! (This will print because the cache was cleared)'; } } ?> ``` ### Summary - `file_exists()` can be affected by PHP's file status cache, potentially leading to outdated results if the file system changes during script execution. - The cache includes information about file existence and basic file metadata. - Use `clearstatcache()` to ensure that `file_exists()` returns up-to-date information after file system changes.


      User

      does Windows 10 cache `modification time` when `file_exists` is called


      ChatGPT

      Windows 10, like other operating systems, can cache file metadata to improve performance. However, the caching behavior is primarily managed by the filesystem and the underlying system, not directly by PHP or the `file_exists()` function. When `file_exists()` is called in PHP, it checks the file system for the existence of the specified file or directory. The `modification time` is a piece of file metadata that can be cached by the operating system's filesystem caching mechanisms, but `file_exists()` itself does not specifically cache the modification time. Instead, it relies on the operating system to provide up-to-date information. ### Key Points: 1. **Filesystem Caching**: - Windows 10, like most modern operating systems, uses various caching mechanisms to speed up file system operations. This includes caching file metadata such as modification times, sizes, and existence checks. - The filesystem cache can sometimes lead to situations where the metadata appears stale because the operating system serves cached information instead of querying the disk again. 2. **PHP File Status Cache**: - PHP itself maintains a file status cache to avoid redundant system calls. This cache can store information about file existence and metadata, including modification times, when functions like `file_exists()`, `stat()`, or `filemtime()` are called. 3. **Clearing the Cache**: - To ensure that your PHP script retrieves the most recent file metadata, including modification time, you should use `clearstatcache()`. This function clears PHP’s internal file status cache, forcing subsequent file operations to fetch fresh information from the filesystem. ### Practical Example: Here’s how you can ensure you get the most up-to-date file metadata in PHP: ```php <?php $file = 'example.txt'; // Create the file file_put_contents($file, 'Sample content'); // Check if the file exists if (file_exists($file)) { echo 'File exists!<br>'; } // Display the file modification time before clearing the cache echo 'Modification time (cached): ' . date('Y-m-d H:i:s', filemtime($file)) . '<br>'; // Clear the file status cache clearstatcache(); // Display the file modification time after clearing the cache echo 'Modification time (fresh): ' . date('Y-m-d H:i:s', filemtime($file)) . '<br>'; // Update the file to change its modification time file_put_contents($file, 'Updated content'); // Clear the cache again to get the latest modification time clearstatcache(); // Display the updated modification time echo 'Modification time (after update): ' . date('Y-m-d H:i:s', filemtime($file)) . '<br>'; ?> ``` ### Summary: - Windows 10 can cache file metadata, including modification times, as part of its filesystem caching mechanism. - PHP's `file_exists()` function relies on the underlying operating system's file system, which can serve cached information. - Use `clearstatcache()` in PHP to clear PHP’s internal cache and ensure that subsequent file metadata operations (like checking modification time) retrieve fresh information from the filesystem.


      User

      Using xampp how can i change the caching behavior of PHP


      ChatGPT

      To change the caching behavior of PHP when using XAMPP, you can modify various settings in the `php.ini` configuration file. The `php.ini` file contains numerous directives that control the behavior of PHP, including how it handles file status caching. Here are the steps to modify caching settings in PHP with XAMPP: ### Step-by-Step Guide: 1. **Locate the `php.ini` File**: - Open your XAMPP control panel. - Click on the `Config` button for the Apache module. - Select `PHP (php.ini)` from the drop-down list. This will open the `php.ini` file in a text editor. 2. **Modify File Status Cache Settings**: - To adjust file status cache settings, you may need to add or modify specific directives. Look for the following settings in the `php.ini` file, or add them if they are not present: ```ini ; Enable realpath cache realpath_cache_size = 16k realpath_cache_ttl = 120 ``` These settings control the realpath cache, which caches the real path of files to improve performance. - `realpath_cache_size`: Sets the size of the realpath cache. You can increase this value if your application works with many files. - `realpath_cache_ttl`: Sets the time-to-live (TTL) for cached paths in seconds. Reduce this value if you need more frequent updates. 3. **Adjust OPCache Settings**: - PHP's OPcache extension can significantly impact caching behavior. To enable and configure OPcache, look for or add the following settings in `php.ini`: ```ini ; Enable OPcache opcache.enable=1 ; Enable OPcache for the CLI version of PHP opcache.enable_cli=1 ; The amount of memory for storing precompiled script bytecode opcache.memory_consumption=128 ; The maximum number of keys (scripts) in the OPcache hash table opcache.max_accelerated_files=10000 ; How often to check script timestamps for changes to the shared memory storage (in seconds) ; 0 means always check for changes (disable caching) opcache.revalidate_freq=2 ; Enable file cache to persist OPcache across requests opcache.file_cache="/path/to/opcache" ; Clear OPcache when files change opcache.validate_timestamps=1 ``` - `opcache.revalidate_freq`: Controls how often to check for script changes. Setting it to `0` means OPcache will always check for changes. - `opcache.validate_timestamps`: When set to `1`, OPcache will validate script timestamps and clear the cache when changes are detected. 4. **Save and Restart**: - Save the changes you made to the `php.ini` file. - Restart Apache from the XAMPP control panel to apply the changes. ### Example: To disable file status caching entirely, you could set the `realpath_cache_ttl` to `0`: ```ini realpath_cache_ttl = 0 ``` This setting will force PHP to revalidate file paths on every request, which can be useful during development but may degrade performance in production. ### Summary: - Locate and edit the `php.ini` file via the XAMPP control panel. - Modify `realpath_cache_size` and `realpath_cache_ttl` to control file status caching. - Configure OPcache settings to adjust script caching behavior. - Save changes and restart Apache to apply the new settings. By tweaking these settings, you can control how PHP caches file information, which can be useful for both development and production environments.


      User

      realpath_cache_size and realpath_cache_ttl is commented out. What is the default realpath_cache_size and realpath_cache_ttl ?


      ChatGPT

      If `realpath_cache_size` and `realpath_cache_ttl` are commented out in the `php.ini` file, PHP will use its default values for these settings. The default values can vary depending on the PHP version and configuration, but typically they are as follows: - **`realpath_cache_size`**: Default is `16K` (16 kilobytes). - **`realpath_cache_ttl`**: Default is `120` seconds (2 minutes). These default values are set to provide a balance between performance and freshness of the cached data. However, they can be adjusted based on the specific requirements of your application. If you want to know the exact default values being used by your PHP installation, you can use the `ini_get()` function to retrieve them programmatically: ```php echo "Default realpath_cache_size: " . ini_get('realpath_cache_size') . "\n"; echo "Default realpath_cache_ttl: " . ini_get('realpath_cache_ttl') . "\n"; ``` This will output the default values currently configured in your PHP installation.
    5. Seconds till midnight
      1. 
        $startdate = "2023-10-27 11:17:00"; 
        $enddate="2023-10-27 00:00:00"; 
        $diff=strtotime($enddate)-strtotime($startdate); 
        echo "diff in seconds: ".$diff;
    6. Alter filemtime with touch, strtotime and clearstatcache
        /*
        Alter filemtime with touch, strtotime and clearstatcache
        // BEGIN alter 7day weather graphic filemtime so if weather3.php is run at midnight the 7day weather graphic will update
        */ 
        
        $file = 'weather-seven-day-forecast-graphic2.jpg';
        echo 'Old time:    '.date('F d, Y h:i:s a',filemtime($file));
        touch($file, strtotime('yesterday 11:59:59 pm'));
        clearstatcache();// otherwise filemtime($file) will be read from cache
        echo '<br />New time: '.date('F d, Y h:i:s a',filemtime($file));
        
    7. file_get_contents fails in localhost solved:
        file_get_contents fails in localhost solved:
        stop apache
        edit apache php.ini
        modify user_agent to:
        user_agent="dfellows.rf.gd dfellows2@gmail.com Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.31"
        restart apache
    8. Cross domain request with proxy.php   JavaScript pumps the request address into proxy.php and proxy.php pumps the response body into JavaScript. See 2CORS.html
      1. <script src="jquery-3.6.0.js"></script>MOON:  <span id="zMoonrise"></span>     <span id="zMoonset"></span><br>SUN:      <span id="zSunrise"></span>     <span id="zSunset"></span><br>SUN2:    <span id="zSunrise2"></span>     <span id="zSunset2"></span><br><script>var data={  "apiversion": "3.0.0",   "geometry": {    "coordinates": [      -93.399376,       37.65369    ],     "type": "Point"  },   "properties": {    "data": {      "closestphase": {        "day": 16,         "month": 4,         "phase": "Full Moon",         "time": "13:55",         "year": 2022      },       "curphase": "Waxing Gibbous",       "day": 15,       "day_of_week": "Friday",       "fracillum": "98%",       "isdst": false,       "label": null,       "month": 4,       "moondata": [        {          "phen": "Upper Transit",           "time": "00:04"        },         {          "phen": "Set",           "time": "06:15"        },         {          "phen": "Rise",           "time": "18:50"        }      ],       "sundata": [        {          "phen": "Begin Civil Twilight",           "time": "06:11"        },         {          "phen": "Rise",           "time": "06:39"        },         {          "phen": "Upper Transit",           "time": "13:14"        },         {          "phen": "Set",           "time": "19:49"        },         {          "phen": "End Civil Twilight",           "time": "20:16"        }      ],       "tz": -5.0,       "year": 2022    }  },   "type": "Feature"};document.getElementById("zMoonrise").innerHTML= data.properties.data.moondata[0].time;document.getElementById("zMoonset").innerHTML= data.properties.data.moondata[2].time;document.getElementById("zSunrise").innerHTML= data.properties.data.sundata[1].time;document.getElementById("zSunset").innerHTML= data.properties.data.sundata[3].time;$.ajax({    type: 'POST',    url: 'proxy.php',    data: {        address: 'https://aa.usno.navy.mil/api/rstt/oneday?date='+new Date().toISOString().split('T')[0]+'&coords=37.653690,-93.399376&tz=-5&dst=false&ID=qatsenzm'    },    dataType: 'json',    success: function(data) {	    console.log(data);document.getElementById("zSunrise2").innerHTML= data.properties.data.sundata[1].time;document.getElementById("zSunset2").innerHTML= data.properties.data.sundata[3].time;    }});
    9. Parse xml weather data
            $weather = simplexml_load_file($filename);	{list($a,$b,$c)=explode(',',$weather->location);	echo '$b ';	echo "$a, $c ";}	echo "Conditions:  $weather->weather ";	echo "TEMP: ".(float)$weather->temp_f. "°F ";	echo "Sunrise: $sunrise_time";	echo "Sunset:  $sunset_time";	echo "WIND from the";	// ": Calm" or " Southwest at 15.0 MPH" or "from the Southwest at 15.0 gusting to 21.9 MPH (13 gusting to 19 KT)" to ":<br>    Southwest at 15.0 gusting to 21.9 MPH"	if(strlen($weather->wind_string)<=5){echo ": ".$weather->wind_string."<br />    "; goto end;}        if(!preg_match('/^[f]/i',$weather->wind_string)){list($a,$b)=explode('(',$weather->wind_string);echo " ".$a.    "<br />";goto end;	} else {	list($a,$b)=explode('(',$weather->wind_string);echo substr($a,8,44)."<br />    ";goto end;}	end:
    10. epoch to readable
      1. echo 'Epoch to readable:<br />navy.json was modified '.date("l, F d, Y h:i:s A T", substr(filemtime('navy.json'), 0, 10));// Saturday, April 9, 2022 10:23:13 PM DST
    11. Json: file_get_contents, decode and echo into HTML
      $json = file_get_contents("https://api.openweathermap.org/data/2.5/onecall?lat=37.60&lon=-93.41&exclude=minutely,alerts&appid=81fd6bf03bee58a02d735b12c7959cf1&units=imperial");$data2 = json_decode($json);<?php echo 'SUNRISE:      '.date('h:i A', ($data2->daily[0]->sunrise)); ?><br /><?php echo 'SUNSET:       '.date('h:i A', ($data2->daily[0]->sunset)); ?><br /><?php echo 'MOONRISE: '.date('h:i A', ($data2->daily[0]->moonrise)); ?><br /><?php echo 'MOONSET:  '.date('h:i A', ($data2->daily[0]->moonset)); ?><br />
    12. How to distinguish between development and production?
      1. Create a file; never upload it; if(file_exists){;}
        1. if(file_exists('15dev.php')){$zerror1='If error you forgot to save the source graphic to weather-seven-day-forecast-graphic.jpg';	} else {//file_put_contents('weather-seven-day-forecast-graphic.jpg',file_get_contents('https://webpubcontent.gray.tv/ky3/weather/7-day_AM.jpg'));$source = fopen('https://webpubcontent.gray.tv/ky3/weather/7-day_AM.jpg', 'r');$dest = fopen(__DIR__ . '/weather-seven-day-forecast-graphic.jpg', 'w');stream_copy_to_stream($source, $dest);fclose($dest);fclose($source);}
    13. Reverse append log. Reverse text. Split on <br />
      1. 032622 - I am thinking of archiving this?
        $executionEndTime = microtime(true); //measure performance$zseconds = $executionEndTime - $GlobalexecutionStartTime; //measure performance $logData=file_get_contents('logData21.html');$logData=$logData.'<br />'.basename(__FILE__).' took '.($executionEndTime - $GlobalexecutionStartTime).' seconds.<br />'.$wind.$z3.' '.basename(__FILE__).'<br />';file_put_contents('logData21.html',$logData);
        // BEGIN REVERSE $logData. Last log entry becomes the first.$logData = explode("<br />",$logData);for($i=count($logData)-1;$i>=0;$i--){$logData[]=$logData[$i]."<br />";unset($logData[$i]);}$logData = implode(" ", $logData);// END REVERSE $logData. Last log entry becomes the first.
    14. Match two strings with file_get_contents and preg_match
      // php find multiple substrings in string; $z=file_get_contents('KSGF.xml');if (preg_match('/Southwest/i', $z)){ if (preg_match('/Fair/i', $z)){ echo 'Fair in Springfield from the Southwest. Sending text.
      '}; // Match second string first to see if the order of the match made a difference. It does not make a difference./* NOAA's National Weather Service https://weather.gov/ https://weather.gov/images/xml_logo.gif https://www.weather.gov 15 minutes after the hour 60 Springfield, Springfield Regional Airport, MO KSGF 37.23972 -93.38972 Last Updated on Feb 28 2022, 1:52 am CST Mon, 28 Feb 2022 01:52:00 -0600 Fair 28.0 F (-2.2 C) 28.0 -2.2 66 Southwest at 8.1 MPH (7 KT) Southwest 210 8.1 7 1025.1 mb 1025.1 30.25 18.0 F (-7.8 C) 18.0 -7.8 20 F (-7 C) 20 -7 10.00 https://forecast.weather.gov/images/wtf/small/ https://www.weather.gov/data/obhistory/KSGF.html nskc.png https://www.weather.gov/data/METAR/KSGF.1.txt https://www.weather.gov/disclaimer.html https://www.weather.gov/disclaimer.html https://www.weather.gov/notice.html*/
    15. Log when a string occurs on a remote server using php script and cronjob
      1. See site_html\38.php
        1. Write to log the time Science Friday recording is put on remote server. If the recording is up the string $z3 (small f so use stripos) will be in the source code. This script runs as a cron job every thirty minutes. If not between $z8 Friday $z4 and $z9 Saturday $z7 exit.

          ScienceFriday.log.html

          ScienceFriday.log2.html raw data

          Online ScienceFriday.log.html

          date_default_timezone_set('America/New_York');$z1=date('h:i:sa'); // 02:50:26am$z8='4pm';$z10='160000'; // START TIME 4pm$z9='7am';$z11='065959'; // END TIME 7AM$z2 = new DateTime();// if not friday {next friday date}else{date}if((date('w')) != 5){$z2->modify('next friday'); // Modify the date it contains$z3=$z2->format('F-j-Y'); // February-18-2022$z4=$z2->format('F j, Y'); // February 18, 2022$z5=$z2->format("Ymj $z10"); // START TIME i.e. 20220218 160000$z2->modify('next saturday');// Modify the date it contains$z6=$z2->format("Ymj $z11"); // END TIME i.e. 20220219 065959$z7=$z2->format('F j, Y'); // February 19 2022}else{	$z3=$z2->format('F-j-Y'); // February-18-2022$z4=$z2->format('F j, Y'); // February 18, 2022$z5=$z2->format("Ymj $z10"); // START TIME i.e. 20220218 160000$z2->modify('next saturday');// Modify the date it contains$z6=$z2->format("Ymj $z11"); // END TIME i.e. 20220219 065959$z7=$z2->format('F j, Y'); // February 19 2022	}echo "

          Script written to log what time Science Friday recording is put on remote server I have no control of in East Time zone. If the recording is up $z3 (small f so use stripos) will be in the source code. This script runs as a cron job every thirty minutes. If not between $z8 Friday $z4 and $z9 Saturday $z7 exit.

          ScienceFriday.log.html

          ScienceFriday.log2.html raw data

          Online ScienceFriday.log.html

          ";// BEGIN https://stackoverflow.com/a/19070232/8826818 $Date = new DateTime();echo $Date->format('m/d/Y H:i:s'); // mm/dd/yyyy hhmmss $DateTimeBegin = new DateTime($z5); // format must be yyyymmdd. punctuation optional: i.e. yyyymmdd yyyy-mm-dd or yyyy/mm/dd ...$DateTimeEnd = new DateTime($z6); if ($Date->getTimestamp() > $DateTimeBegin->getTimestamp() && $Date->getTimestamp() < $DateTimeEnd->getTimestamp()){ echo " is between"; $result = file_get_contents('https://www.sciencefriday.com/radio/'); $test = stripos($result, date('F-j-Y')); // case insensitive February-18-2022 if ($test==false) { echo "no. $z3 (small f) does not exist on ScienceFriday."; $fileContent = file_get_contents('ScienceFriday.log2.html'); file_put_contents('ScienceFriday.log2.html', date('h:i:sa').' no. $z3 (small f) does not exist on ScienceFriday ' . $fileContent); } else { echo "yes. $z3 (small f) does exist on ScienceFriday."; $fileContent = file_get_contents('ScienceFriday.log2.html'); file_put_contents('ScienceFriday.log2.html', date('h:i:sa').' yes. $z3 (small f) does exist on ScienceFriday ' . $fileContent); } }else{ echo " is not between. Logging and exiting."; }// END https://stackoverflow.com/a/19070232/8826818 $fileContent1 = file_get_contents('ScienceFriday.log1.html');$fileContent2 = file_get_contents('ScienceFriday.log2.html');file_put_contents('ScienceFriday.log2.html', $z1.' Log of when cron job fires.<br />'. $fileContent2); file_put_contents('ScienceFriday.log.html', $fileContent1. $fileContent2.'</div></body></html>'); exit ;
    16. Daylight savings time or standard time. daylight saving time.
       CST
    17. SINGLE AND DOUBLE QUOTES - When to use
      1. Failure:
        1. echo "she said, "how are you?"";
        2. echo 'I'm just ducky.';
      2. solution 1:
        1. echo 'she said, "how are you?"';
        2. echo "I'm just ducky.";
      3. solution 2:
        1. echo "she said, \"how are you?\"";
        2. echo 'I\'m just ducky.';
    18. PRINT OUT THE NAME OF THE RUNNING SCRIPT
      1. ECHO $_SERVER['SCRIPT_FILENAME'];
    19. How does a PHP application work?
      1. How does a PHP application work?

        Most of us are familiar with how a web application works. We know that when we enter an URL in our browser, it’ll contact a web server who’ll returnsome HTML. The browser will then make follow-up requests and then render the web page. (This is a simplification! But that’s the main idea.)

        Butwhat’s happening on the web server returning HTML? How is the web server getting the HTML that it returns to our browser? And, to be even more specific, how does this happen in PHP?

        Thisisn’t something that most of us know how to answer. We know (or at least should know!) how to build a PHP website. But what happens betweenour PHP code and the browser is a bit of a mystery.

        There’sa good chance that you’re thinking, “Well, my site loads. Why should I think twice about this?” And that’s true! But the truth is that knowing how a PHP application works can be useful.

        Itcan affect how you design your PHP application. But it’s also importantif you’re looking to improve its performance. For example, it’s hard tounderstand PHP application caching if you don’t understand how a PHP application works.

        The life of a PHP request

        If you come from a compiled language (like Java or C#), the biggest thing to understand is that PHP isn’t one. It’s an interpreted language. This means that PHP will need to interpret and compile the code of your application for each request made to it.

        Now,you can use caching and other optimizations to speed this process up. But the nature of how requests to your PHP application work won’t change. They’ll always look like this:

        Asyou can see in the diagram above, we always start with a browser makinga request for a web page. This request is going to hit the web server. The web server will then analyze it and determine what to do with it.

        If the web server determines that the request is for a PHP file (often index.php),it’ll pass that file to the PHP interpreter. The PHP interpreter will read the PHP file, parse it (and other included files) and then execute it. Once the PHP interpreter finishes executing the PHP file, it’ll return an output. The web server will take that output and send it back as a response to the browser.

        A PHP application is just a script

        Thiswas the goal of explaining the life cycle of a PHP request was to get to this statement. This is the truth behind any PHP application whether it’s a Laravel or Symfony application. (Or even a CMS like Drupal or WordPress.) They’re all nothing more than scripts much like a shell script.

        Inthis scenario, the web server is nothing more than an intermediary. Each time that someone makes a request for a PHP page, it’s just asking the web server to run a specific PHP script. If the PHP script returns any output, the web server sends it back.

        Thisis different to what you’ll see in with other web programming languages. These web programming languages create what we’ll call more traditional web applications. These traditional web applications often work using an application server. Some well-known application servers are Tomcat for Java, IIS for .NET, Gunicorn for Python, Unicorn for Ruby.

        Workingwith an application server is different in some fundamental ways. The most important one is that a traditional web application resides within the application server. It’s not a script that your web server can call.In fact, these application servers also act as web servers. The diagrambelow should help you visualize this.

        Asyou can see, the web application is inside of the application server. (There can even be more than one web application per application server!) This application server is also your web server. Any request that you make to it is the same as a request to the web application. It’s not an intermediary like it is with PHP.

        Different dynamics

        Thisfundamental difference between a PHP application and more traditional web application is important. It changes a lot of the dynamics around them. For example, this is why you can edit any PHP file on a server andsee the changes right away. (Well, that’s unless you have some caching solution in place!)

        Butyou can’t say the same about traditional web applications. These applications often only let you edit template files on the fly. Any other changes will require that you restart the application server at a minimum. (Things get more complicated if you use a compiled language.)

        Thatsaid, this isn’t the only difference between a PHP application and a traditional one. There are other differences that are important to know.So let’s look at some of them.

        Memory management

        Let’s start with memory management.How do we manage memory when we’re working with a PHP application? The answer is that most of us don’t manage memory when we’re working on a PHP application.

        We only do something if PHP gives us an out of memory error. And often we’ll just increase the PHP’s memory limit when we encounter that error. We’ll then move on and continue working on whatever we were working on before we saw the error.

        Ifyou’re more performance focused, you’ll try to reduce the memory usage of your code. For example, let’s say that you’re running out of memory storing a big XML file in memory using SimpleXML. You can switch to XMLReader to traverse the XML file instead.

        Memory leaks

        Have you ever encountered a memory leakwith PHP? Memory leaks are the result of improper memory management like our out of memory errors. They happen you persist data in memory and that memory never gets cleared once you’re done with the data.

        Thatsaid, memory leaks are quite rare with PHP applications. That’s becausePHP is a script that runs and then terminates. Once terminated, PHP will clear all the memory used by the script. Resetting memory that way prevents most PHP applications from having memory leaks.

        Butthis isn’t the case with a more traditional web application. Since the application is part of the web server, it only terminates when you restart the web server itself. This doesn’t (or shouldn’t!) happen very often. This means that memory leaks are a common reality with those types of applications.

        Memoryleaks have real consequences with a more traditional web application. If you don’t restart your application server, your server will run out of memory at some point. When that happens, the application server will crash taking your web application with it.

        Data persistence

        Sowe’re pretty clear on how what memory leaks are and why PHP doesn’t suffer from that problem much. But this isn’t the only unique aspect of memory management in PHP either. PHP also doesn’t have any built-in way to persist data in memory.

        Infact, part of the reason why there are few memory leaks in PHP is because of this aspect of memory management in PHP. Let’s imagine that we have two identical requests for our PHP application. The first one runs through our PHP script and stores data in memory in the process. None of that data will be available to the second request.

        Thisties to what we explained about PHP scripts earlier. Once the PHP finishes executing a script, the operating system clears the memory thatit used. This means that PHP can’t share data between requests by usingmemory like a traditional web application would.

        Instead, PHP depends on other systems to share data between requests. You can use sessions which themselves use a storage method. A storage method could be a file, a data store or even a database.

        APHP application tends to make use of one or more of these storage methods. Which ones you use depends on what your application supports and your needs. But, if you have to pick one, using a data store like Redis or Memcached tends to be the most popular option.

        Concurrency

        Concurrencyis another concept that’s important to understand with PHP applications. What is concurrency? It’s the idea that you can break downsoftware into smaller parts. You can then execute these smaller parts at the same time or in a different order without anything breaking.

        Now,explained like this, concurrency doesn’t really make sense with PHP applications. PHP doesn’t break down our application into smaller parts and run them at the same time. That said, concurrency still applies because of how PHP handles multiple requests to an application.

        Aswe’ve seen so far, each request made to a PHP application is independent of the other. The web server will pass the request to the PHP interpreter who’ll run the script of our PHP application. This meansthat it’s very common for the PHP interpreter to be processing more than one script at the same time.

        Thetimeline above attempts to highlight this using a timeline. We have three concurrent processes of a PHP script. They start and finish at different times, but some of their execution overlaps.

        Thisis why you should keep concurrency in mind when working with a PHP application. And concurrency like memory management has more than one implication with PHP. That said, they’re not things that you have to think about all the time. (But it’s still good to know about them!)

        Multitasking

        Let’s start with multitasking. Multitasking is the idea that you can perform a set of computer tasks faster if you do them at the same time. PHP applications rely on this concept a lot to do computing intensive tasks.

        That’sbecause it’s quite easy to implement multitasking in PHP. As we’ve seenalready, it’s possible for the PHP interpreter to process more than onescript at a time. So multitasking comes down to creating requests for these extra tasks that we need to do.

        Howdoes this work? Well, as you can see in the above diagram, you have an initial request to your PHP application. This initial request will causethe PHP application to generate other subrequests to itself. These other subrequests are our new application tasks. They run at the same time as our initial request.

        It’s worth pointing out that these requests are often sent asynchronously.They don’t have a large impact on the execution time of a PHP script. This means that they don’t slow down the execution of the PHP application during the initial request.

        A good example of multitasking in PHP applications is how popular PHP CMSs handle cron jobs.In a CMS, a cron job is a task that you scheduled (like publishing a future post) in the future that you need your CMS to handle. A CMS handles these cron jobs by creating a request for a specific URL whenever you make a request to the CMS.

        Resource starvation

        But concurrency isn’t without issues either. The most common one is resource starvationwhich means exactly what the name suggests. It refers to your concurrent PHP processes not having the resources they need to run well (or at all).

        It’sworth pointing out that memory leaks which we saw earlier are a form ofresource starvation. The growing memory leak starves the server’s memory until the application stops working. But, since PHP applications don’t suffer from memory leaks, it’s not the cause of the problem here.

        Let’simagine that your server has 300megs of free memory. And your PHP application takes on average 50megs of memory during its execution. Thismeans that, in theory, your server can only handle six concurrent executions.

        Sowhat happens if your server needs to process more than six scripts at atime? Well, at this point, it depends on how your host configured your server. It could just slow down or it could outright die. (That’s the idea behind most denial-of-service attacks.)

        Thisis why resource starvation isn’t so much of an issue with your PHP application. Yes, you could its reduce memory usage. And, as a result, you’d be able to have more concurrent executions of your PHP application.

        Butit would be better to configure your server so that it doesn’t ever tryto do too many concurrent executions. That’s why it’s an important configuration setting for a PHP application server. Resource starvation is more of a server configuration issue than an application issue.

        Race conditions

        Another issue to be aware of with concurrency is race conditions.A race condition is a bit of a complicated problem that’s easier to explain with an example. A common example of a race condition is tracking page views. That said, most types of tracking are susceptible to race conditions.

        Aboveis a timeline of our PHP code that’s tracking the page views. The page view tracking code is in pink. In it, we fetch the current number of page views, increment the number by one and then save the value again. This is all pretty straightforward so far.

        Now,let’s add concurrency to the mix! What happens if there are multiple executions of our page view tracking PHP code at the same time? Well, let’s update our timeline and find out.

        Everythinglooks ok in this timeline. We have multiple executions of our PHP code,but none of the pink bars overlap. Each execution is able to fetch the current number of page views, increment it by one and then save it again.

        Race condition in practice

        Butwhat happens if multiple executions of our PHP code overlap? After all,it’s not realistic to expect our executions to be nice and spread out like that all the time. Well, this is where things start to break down.

        Here’sa timeline where our three executions are closer in time to one another. As you can see, the execution of our page view tracking PHP code overlaps now. This code overlap is our race condition.

        Becauseof it, the page view increment from the second process is incorrect. That’s because it fetches the page view count before the first process saved it back. So it counts the same number of page views as the first process.

        Butthat’s not the end of it either! Because of the race condition, the third process also overwrites the number of page views recorded by the second process. If we had more concurrent processes, this would compoundthe problems caused by the race condition.

        Theresult is an inaccurate tracking of the number of page views. Our page view tracking code ended up counting only two page views when it should’ve counted three. That’s a serious problem if you bothered to design such a system.

        Fixing a race condition

        Sohow do we fix the race condition in our page view tracking PHP code? The obvious solution is to not do it and use an external service like Google Analytics. But that’s not an especially useful solution if you want to learn to fix race conditions!

        Well,the problem with race conditions is that there are countless ways to fix them. We can’t cover them all in this article. But let’s not let this prevent us from talking about it a bit!

        The key to fixing a race condition is the concept of mutual exclusion. Mutual exclusion is itself a property of larger topic called concurrency control.And the point of concurrency control is to ensure that concurrent operations (like our tracking of page views) generate the correct results.

        Now,let’s go back to mutual exclusion. Mutual exclusion is the idea that only one execution can enter a critical piece of code at a time. This prevents race conditions because you can’t have more than one execution of this piece of code at a time.

        Mutual exclusion using a lock

        And how can we implement mutual exclusion with PHP? One of the common ways to implement it is with a lock.You use a lock to limit the access to a resource. In this scenario, this would be the number of page views that we only want one process to access at a time.

        Thistimeline shows what happens to our page view tracking code when we use alock. The yellow bar in our timeline represents the time spent waiting for the other execution to release the lock. Our page view tracking codecan only begin when that happens.

        But even then, there’s more than one way of implementing a lock! For example, you could use a semaphore. This is a special variable or data type that you can use to determine if a resource is in use or not. There are semaphores in PHP so it’s one option that you have available.

        Mutual exclusion using message passing

        Another option besides using a lock is to use message passing.Message passing revolves around isolating a critical piece of code inside your web application. Once isolated, your code should never make acall to this piece of code ever again. Instead, it should send a message to the web application to run it for you.

        So,in the case of our page view tracking code, we would isolate that code inside our application. We would then replace that code with code that sends a message to our application. This message would tell our application to run this code for us.

        Buthow is that different from making a call to our page view tracking code? The critical element to message passing is that you send the message outside the current process. Your current process won’t run the critical piece of code that causes the race condition.

        Instead,it’s another process that runs it. And that process can enforce mutual exclusion for that critical piece of code. This ends up preventing the race condition.

        A lot of PHP applications use a message queueto implement their messaging system. The PHP application will send a message to the message queue. The message queue will then process each message one at a time in the order that it received them.

        There are a lot of choices from message queue systems. Some frameworks (such as Laravel)also have their own message queue system. Either way, it’s a great way to implement mutual exclusion inside your PHP application.

        PHP applications are unique

        Asyou can see, PHP applications are in a category of their own. They don’t quite behave in ways that a lot of web developers are familiar with. This is especially true if they come from other programming languages. (But even PHP developers don’t always know how they work!)

        Thatsaid, there are also some common elements with other programming languages. But it’s knowing what’s the same and what’s different that’s important in the end. It’ll help you do a better job architecting your solutions using PHP.

    20. ESCAPE SPACES IN PATH
      1. ESCAPE SPACES IN PATH
        1. exec("cp -f $HOME/private/2BACKUP\ DOUG/*.* $HOME2/$today/php/2backup\ doug",$out,$err);            
          ECHO "backup $56/*.* to $HOME2/$today/php/$56/ ";
          ECHO "RESULTS IS : ".$err."";
    21. Clear localhost log every day
      1. Clear localhost log every day
        // Clear localhost log every day$headers=get_headers("http://localhost/dfellows.rf.gd/htdocs/site_html/weather-seven-day-forecast-graphicLOG.html", 1);$str=($headers["Last-Modified"]); // Tue, 11 Feb 2020 10:39:44 GMTif ((date('d')) - (substr($str, 5, 2)) >= 2){file_put_contents('weather-seven-day-forecast-graphicLOG.html', '');}
    22. Remove X oldest entries in log. Oldest is determined by the occurrence of a string.
      1. Remove X oldest entries in log. Oldest is determined by the occurrence of a string.
        // BEGIN EDIT LOG IF THERE ARE MORE THAN 45 ENTRIESecho '<br />';$z=file_get_contents('weather-seven-day-forecast-graphicLOG.html'); // string // echo gettype($z); if (substr_count($z,'<br />') > 99) { $z  = explode('<br />', $z);array_pop($z); // remove last element in array.$z = implode('<br />', $z); // stringfile_put_contents('weather-seven-day-forecast-graphicLOG.html', $z);}echo $z; // display contents of weather-seven-day-forecast-graphicLOG.html//      END EDIT LOG IF THERE ARE MORE THAN 45 ENTRIES
    23. Sleep 2 seconds when your host prohibits Sleep(), exec, ...;
      1. Sleep 2 seconds when your host prohibits Sleep(), exec, ...
        $now = time();while ($now + 2 > time()) {echo " ";}
    24. Goto
      1. Goto
        // Add 1 to x five times.$x=0;start:$x++;echo "x=$x\n";if ($x<5)   goto start;Output:x=1x=2x=3x=4x=5
    25. For loop through array
      1. For loop through array
        $images = ["weather-seven-day-forecast-graphic.png", "weather-seven-day-forecast-graphic.jpg"];foreach ($images as $image)  {echo $image ."<br />";}
    26. Script failures
      1. xampp error 500
        .htaccess uncommented comment
    27. Remove lines from a text file that does not contain a string using PHP and Windows:
      1. Alter $zm to search for your string. My string was the numeric representation of a month with leading zeros (i.e. 01 through 12) surrounded by forward slash: /10/   php date format.
        $content = file_get_contents("weather-seven-day-forecast-graphicURLd.txt");$lines = explode(PHP_EOL, $content);$remaining = array_filter($lines, function($line) {$zm="/".date('m')."/"; // remove lines that do not contain string i.e. /10/return strpos($line, $zm) !== false;});file_put_contents("weather-seven-day-forecast-graphicURLd.txt", implode("\r\n", $remaining), FILE_APPEND);
    28. Read text file, add one to the value in text file, write text file.
      1. October 5, 2020 is "week 4" of the NFL season. How to search for the "week 5" playlist URL on youtube.
        //  Read text file, add one to the value in text file, write text file.$z="\r\nWhat week of the NFL season is it? October 4, 2020 is the beginning of Week 4 of the NFL 2020 season ";$content = file('week.txt'); // read file$zweek = intval($content[0]) + 1; // add 1 to the value on line 1file_put_contents('week.txt', $zweek.$z); // update file

  31. JAVASCRIPT (Top)
    1. See php
      1. Json: file_get_contents, decode and echo into HTML
    2. new Date()
      1. Yesterday
        1. // yesterdayvar date = new Date();date ; //# => Fri Apr 01 2011 11:14:50 GMT+0200 (CEST)date.setDate(date.getDate() - 1); // yesterdaydate ; 
      2. Everything You Need to Know About Date in JavaScript
        1. In JavaScript, if you want to use a date string, you need to use a format that’s accepted worldwide. One of these formats is the ISO 8601 Extended format.
          new Date().toISOString(YYYY-MM-DDTHH:mm:ss.sssZ)
        2. I recommend you don’t create dates with date strings.
          1. If you want to create dates, use arguments.

            Screenshot javascript new Date() 11th June 2019, 5:23:59am, Local Time

            You can pass in up to seven arguments to create a date/time.

            1. Year: 4-digit year.
            2. Month: Month of the year (0-11). Month is zero-indexed. Defaults to 0 if omitted.
            3. Day: Day of the month (1-31). Defaults to 1 if omitted.
            4. Hour: Hour of the day (0-23). Defaults to 0 if omitted.
            5. Minutes: Minutes (0-59). Defaults to 0 if omitted.
            6. Seconds: Seconds (0-59). Defaults to 0 if omitted.
            7. Milliseconds: Milliseconds (0-999). Defaults to 0 if omitted.
      3. yyyymmdd
        1. new Date().toLocaleDateString('en-GB').split('/').reverse().join('-'); // = 2022-02-04 yyyymmdd javascript ; 			new Date().toISOString().split('T')[0]; // = 2022-02-04 yyyymmdd javascript ; 
    3. RUNNING CLOCK
      <span id='ct'></span>function display_c() {var refresh = 1000; // Refresh rate in milli secondsmytime = setTimeout('display_ct()', refresh)}function display_ct() {var strcountvar x = new Date()document.getElementById('ct').innerHTML = x.toString().replace(/GMT(.*)/g,"");tt = display_c();}display_ct() ;
    4. Static clock
      1. <script> /*https://stackoverflow.com/questions/4522213*/ function startTime(){
        var today=new Date();var hr=today.getHours();var min=today.getMinutes();
        var sec=today.getSeconds();ap=(hr<12)?"<span>am</span>":"<span>pm</span>";
        hr=(hr==0)?12:hr;hr=(hr>12)?hr-12:hr;hr=checkTime(hr);min=checkTime(min);
        sec=checkTime(sec);document.getElementById("clock").innerHTML=hr+":"+min+":"+sec+""+ap;
        var time=setTimeout(function(){startTime()},500);}function checkTime(i){if(i<10){i="0"+i;}return i;}
        </script> </head><body onload="startTime()"><span id=clock></span>
  32. CMD (Top)
    1. Count files
      rem Count filesFOR /F %%g IN ('DIR /B /A:-D %zfolder%\*.mp4 ^| FIND /V /C "::"') DO set zcount=%%gFOR /F %g IN ('DIR /B /A:-D %zfolder%\*.mp4 ^| FIND /V /C "::"') DO set zcount=%g
    2. Concatenate .mp4 with Windows 10 64-bit, cmd and ffmpeg using intermediate .ts file
      rem Concatenate .mp4 with Windows 10 64-bit, cmd and ffmpeg using intermediate .ts filerem get sample .mp4 https://www.vjloops.com/stock-video/circle-flow-offsets-01-138855.htmlrem BEGIN PREPrem make directory mmddyy-hhmmss i.e. 081721-085851FOR /f "TOKENS=1-4" %%g in ('time/T') do set zhhmmss=%%g%%i%TIME:~10,2%FOR /f "TOKENS=1-4" %g in ('time/T') do set zhhmmss=%g%i%TIME:~10,2%set zfolder=%DATE:~-10,2%%DATE:~-7,2%%DATE:~-2,2%-%zhhmmss%md "%zfolder%"for /l %g in (2,1,4) do copy /y "1.mp4" "%zfolder%\%g.mp4"for /l %%g in (2,1,4) do copy /y "1.mp4" "%zfolder%\%%g.mp4"rem   END PREPrem BEGIN CONCATENATE for %g in (%zfolder%\*.mp4) do (echo ffmpeg -y -i "%g" -c copy -bsf:v h264_mp4toannexb "%zfolder%\%~ng.ts")for %g in ("%zfolder%\*.ts") do (echo file '%g')>>list.txtrem -crf quality 23 = default, 51 = worst, 0 = best ffmpeg -f concat -safe 0 -i "list.txt" -crf 40 output.mp4rem copy .mp4 to .tsfor %%g in (%zfolder%\*.mp4) do (ffmpeg -y -i "%%g" -c copy -bsf:v h264_mp4toannexb "%zfolder%\%%~ng.ts")rem Make ASCII list of filesfor %%g in ("%zfolder%\*.ts") do (echo file '%%g')>>list.txtffmpeg -f concat -safe 0 -i "list.txt" -c copy output.mp4rem -crf quality 23 = default, 51 = worst, 0 = best  ffmpeg -f concat -safe 0 -i "list.txt" -crf 40 output.mp4pause rem   END CONCATENATErem CLEAN UPrd /q /s %zfolder%
    3. How does CMD parse scripts:
      1. How does CMD parse scripts:

        Here is a brief overview of phases in the batch file line parser:

        Phase 0) Read Line:

        Phase 1) Percent Expansion:

        Phase 2) Process special characters, tokenize, and build a cached command block: This is a complex process that is affected by things such as quotes, special characters, token delimiters, and caret escapes.

        Phase 3) Echo the parsed command(s) Only if the command block did not begin with @, and ECHO was ON at the start of the preceding step.

        Phase 4) FOR %X variable expansion: Only if a FOR command is active and the commands after DO are being processed.

        Phase 5) Delayed Expansion: Only if delayed expansion is enabled

        Phase 5.3) Pipe processing: Only if commands are on either side of a pipe

        Phase 5.5) Execute Redirection:

        Phase 6) CALL processing/Caret doubling: Only if the command token is CALL

        Phase 7) Execute: The command is executed


        Here are details for each phase:

        Note that the phases described below are only a model of how the batch parser works. The actual cmd.exe internals may not reflect these phases. But this model is effective at predicting behavior of batch scripts.

        Phase 0) Read Line: Read line of input through first <LF>.

        • When reading a line to be parsed as a command, <Ctrl-Z> (0x1A) is read as <LF> (LineFeed 0x0A)
        • When GOTO or CALL reads lines while scanning for a :label, <Ctrl-Z>, is treated as itself - it is not converted to <LF>

        Phase 1) Percent Expansion:

        • A double %% is replaced by a single %
        • Expansion of arguments (%*, %1, %2, etc.)
        • Expansion of %var%, if var does not exist replace it with nothing
        • Line is truncated at first <LF> not within %var% expansion
        • For a complete explanation read the first half of this from dbenham Same thread: Percent Phase

        Phase 2) Process special characters, tokenize, and build a cached command block: This is a complex process that is affected by things such as quotes, special characters, token delimiters, and caret escapes. What follows is an approximation of this process.

        There are concepts that are important throughout this phase.

        • A token is simply a string of characters that is treated as a unit.
        • Tokens are separated by token delimiters. The standard token delimiters are <space> <tab> ; , = <0x0B> <0x0C> and <0xFF>
          Consecutive token delimiters are treated as one - there are no empty tokens between token delimiters
        • There are no token delimiters within a quoted string. The entire quoted string is always treated as part of a single token. A single token may consist of a combination of quoted strings and unquoted characters.

        The following characters may have special meaning in this phase, depending on context: <CR> ^ ( @ & | < > <LF> <space> <tab> ; , = <0x0B> <0x0C> <0xFF>

        Look at each character from left to right:

        • If <CR> then remove it, as if it were never there (except for weird redirection behavior)
        • If a caret (^), the next character is escaped, and the escaping caret is removed. Escaped characters lose all special meaning (except for <LF>).
        • If a quote ("), toggle the quote flag. If the quote flag is active, then only " and <LF> are special. All other characters lose their special meaning until the next quote toggles the quote flag off. It is not possible to escape the closing quote. All quoted characters are always within the same token.
        • <LF> always turns off the quote flag. Other behaviors vary depending on context, but quotes never alter the behavior of <LF>.
          • Escaped <LF>
            • <LF> is stripped
            • The next character is escaped. If at the end of line buffer, then the next line is read and processed by phases 1 and 1.5 and appended to the current one before escaping the next character. If the next character is <LF>, then it is treated as a literal, meaning this process is not recursive.
          • Unescaped <LF> not within parentheses
            • <LF> is stripped and parsing of the current line is terminated.
            • Any remaining characters in the line buffer are simply ignored.
          • Unescaped <LF> within a FOR IN parenthesized block
            • <LF> is converted into a <space>
            • If at the end of the line buffer, then the next line is read and appended to the current one.
          • Unescaped <LF> within a parenthesized command block
            • <LF> is converted into <LF><space>, and the <space> is treated as part of the next line of the command block.
            • If at the end of line buffer, then the next line is read and appended to the space.
        • If one of the special characters & | < or >, split the line at this point in order to handle pipes, command concatenation, and redirection.
          • In the case of a pipe (|), each side is a separate command (or command block) that gets special handling in phase 5.3
          • In the case of &, &&, or || command concatenation, each side of the concatenation is treated as a separate command.
          • In the case of <, <<, >, or >> redirection, the redirection clause is parsed, temporarily removed, and then appended to the end of the current command. A redirection clause consists of an optional file handle digit, the redirection operator, and the redirection destination token.
            • If the token that precedes the redirection operator is a single unescaped digit, then the digit specifies the file handle to be redirected. If the handle token is not found, then output redirection defaults to 1 (stdout), and input redirection defaults to 0 (stdin).
        • If the very first token for this command (prior to moving redirection to the end) begins with @, then the @ has special meaning. (@ is not special in any other context)
          • The special @ is removed.
          • If ECHO is ON, then this command, along with any following concatenated commands on this line, are excluded from the phase 3 echo. If the @ is before an opening (, then the entire parenthesized block is excluded from the phase 3 echo.
        • Process parenthesis (provides for compound statements across multiple lines):
          • If the parser is not looking for a command token, then ( is not special.
          • If the parser is looking for a command token and finds (, then start a new compound statement and increment the parenthesis counter
          • If the parenthesis counter is > 0 then ) terminates the compound statement and decrements the parenthesis counter.
          • If the line end is reached and the parenthesis counter is > 0 then the next line will be appended to the compound statement (starts again with phase 0)
          • If the parenthesis counter is 0 and the parser is looking for a command, then ) functions similar to a REM statement as long as it is immediately followed by a token delimiter, special character, newline, or end-of-file
            • All special characters lose their meaning except ^ (line concatenation is possible)
            • Once the end of the logical line is reached, the entire "command" is discarded.
        • Each command is parsed into a series of tokens. The first token is always treated as a command token (after special @ have been stripped and redirection moved to the end).
          • Leading token delimiters prior to the command token are stripped
          • When parsing the command token, ( functions as a command token delimiter, in addition to the standard token delimiters
          • The handling of subsequent tokens depends on the command.
        • Most commands simply concatenate all arguments after the command token into a single argument token. All argument token delimiters are preserved. Argument options are typically not parsed until phase 7.
        • Three commands get special handling - IF, FOR, and REM
          • IF is split into two or three distinct parts that are processed independently. A syntax error in the IF construction will result in a fatal syntax error.
            • The comparison operation is the actual command that flows all the way through to phase 7
              • All IF options are fully parsed in phase 2.
              • Consecutive token delimiters collapse into a single space.
              • Depending on the comparison operator, there will be one or two value tokens that are identified.
            • The True command block is the set of commands after the condition, and is parsed like any other command block. If ELSE is to be used, then the True block must be parenthesized.
            • The optional False command block is the set of commands after ELSE. Again, this command block is parsed normally.
            • The True and False command blocks do not automatically flow into the subsequent phases. Their subsequent processing is controled by phase 7.
          • FOR is split in two after the DO. A syntax error in the FOR construction will result in a fatal syntax error.
            • The portion through DO is the actual FOR iteration command that flows all the way through phase 7
              • All FOR options are fully parsed in phase 2.
              • The IN parenthesized clause treats <LF> as <space>. After the IN clause is parsed, all tokens are concatenated together to form a single token.
              • Consecutive unescaped/unquoted token delimiters collapse into a single space throughout the FOR command through DO.
            • The portion after DO is a command block that is parsed normally. Subsequent processing of the DO command block is controled by the iteration in phase 7.
          • REM detected in phase 2 is treated dramatically different than all other commands.
            • Only one argument token is parsed - the parser ignores characters after the first argument token.
            • The REM command may appear in phase 3 output, but the command is never executed, and the original argument text is echoed - escaping carets are not removed, except...
              • If there is only one argument token that ends with an unescaped ^ that ends the line, then the argument token is thrown away, and the subsequent line is parsed and appended to the REM. This repeats until there is more than one token, or the last character is not ^.
        • If the command token begins with :, and this is the first round of phase 2 (not a restart due to CALL in phase 6) then
          • The token is normally treated as an Unexecuted Label.
            • The remainder of the line is parsed, however ), <, >, & and | no longer have special meaning. The entire remainder of the line is considered to be part of the label "command".
            • The ^ continues to be special, meaning that line continuation can be used to append the subsequent line to the label.
            • An Unexecuted Label within a parenthesized block will result in a fatal syntax error unless it is immediately followed by a command or Executed Label on the next line.
              • ( no longer has special meaning for the first command that follows the Unexecuted Label.
            • The command is aborted after label parsing is complete. Subsequent phases do not take place for the label
          • There are three exceptions that can cause a label found in phase 2 to be treated as an Executed Label that continues parsing through phase 7.
            • There is redirection that precedes the label token, and there is a | pipe or &, &&, or || command concatenation on the line.
            • There is redirection that precedes the label token, and the command is within a parenthesized block.
            • The label token is the very first command on a line within a parenthesized block, and the line above ended with an Unexecuted Label.
          • The following occurs when an Executed Label is discovered in phase 2
            • The label, its arguments, and its redirection are all excluded from any echo output in phase 3
            • Any subsequent concatenated commands on the line are fully parsed and executed.
          • For more information about Executed Labels vs. Unexecuted Labels, see https://www.dostips.com/forum/viewtopic.php?f=3&t=3803&p=55405#p55405

        Phase 3) Echo the parsed command(s) Only if the command block did not begin with @, and ECHO was ON at the start of the preceding step.

        Phase 4) FOR %X variable expansion: Only if a FOR command is active and the commands after DO are being processed.

        • At this point, phase 1 of batch processing will have already converted a FOR variable like %%X into %X. The command line has different percent expansion rules for phase 1. This is the reason that command lines use %X but batch files use %%X for FOR variables.
        • FOR variable names are case sensitive, but ~modifiers are not case sensitive.
        • ~modifiers take precedence over variable names. If a character following ~ is both a modifier and a valid FOR variable name, and there exists a subsequent character that is an active FOR variable name, then the character is interpreted as a modifier.
        • FOR variable names are global, but only within the context of a DO clause. If a routine is CALLed from within a FOR DO clause, then the FOR variables are not expanded within the CALLed routine. But if the routine has its own FOR command, then all currently defined FOR variables are accessible to the inner DO commands.
        • FOR variable names can be reused within nested FORs. The inner FOR value takes precedence, but once the INNER FOR closes, then the outer FOR value is restored.
        • If ECHO was ON at the start of this phase, then phase 3) is repeated to show the parsed DO commands after the FOR variables have been expanded.

        ---- From this point onward, each command identified in phase 2 is processed separately.
        ---- Phases 5 through 7 are completed for one command before moving on to the next.

        Phase 5) Delayed Expansion: Only if delayed expansion is on, the command is not in a parenthesized block on either side of a pipe, and the command is not a "naked" batch script (script name without parentheses, CALL, command concatenation, or pipe).

        • Each token for a command is parsed for delayed expansion independently.
          • Most commands parse two or more tokens - the command token, the arguments token, and each redirection destination token.
          • The FOR command parses the IN clause token only.
          • The IF command parses the comparison values only - either one or two, depending on the comparison operator.
        • For each parsed token, first check if it contains any !. If not, then the token is not parsed - important for ^ characters. If the token does contain !, then scan each character from left to right:
          • If it is a caret (^) the next character has no special meaning, the caret itself is removed
          • If it is an exclamation mark, search for the next exclamation mark (carets are not observed anymore), expand to the value of the variable.
            • Consecutive opening ! are collapsed into a single !
            • Any remaining unpaired ! is removed
          • Expanding vars at this stage is "safe", because special characters are not detected anymore (even <CR> or <LF>)
          • For a more complete explanation, read the 2nd half of this from dbenham same thread - Exclamation Point Phase

        Phase 5.3) Pipe processing: Only if commands are on either side of a pipe
        Each side of the pipe is processed independently and asynchronously.

        • If command is internal to cmd.exe, or it is a batch file, or if it is a parenthesized command block, then it is executed in a new cmd.exe thread via %comspec% /S /D /c" commandBlock", so the command block gets a phase restart, but this time in command line mode.
          • If a parenthesized command block, then all <LF> with a command before and after are converted to <space>&. Other <LF> are stripped.
        • This is the end of processing for the pipe commands.
        • See Why does delayed expansion fail when inside a piped block of code? for more about pipe parsing and processing

        Phase 5.5) Execute Redirection: Any redirection that was discovered in phase 2 is now executed.

        Phase 6) CALL processing/Caret doubling: Only if the command token is CALL, or if the text before the first occurring standard token delimiter is CALL. If CALL is parsed from a larger command token, then the unused portion is prepended to the arguments token before proceeding.

        • Scan the arguments token for an unquoted /?. If found anywhere within the tokens, then abort phase 6 and proceed to Phase 7, where the HELP for CALL will be printed.
        • Remove the first CALL, so multiple CALL's can be stacked
        • Double all carets
        • Restart phases 1, 1.5, and 2, but do not continue to phase 3
          • Any doubled carets are reduced back to one caret as long as they are not quoted. But unfortunately, quoted carets remain doubled.
          • Phase 1 changes a bit
            • Expansion errors in step 1.2 or 1.3 abort the CALL, but the error is not fatal - batch processing continues.
          • Phase 2 tasks are altered a bit
            • Any newly appearing unquoted, unescaped redirection that was not detected in the first round of phase 2 is detected, but it is removed (including the file name) without actually performing the redirection
            • Any newly appearing unquoted, unescaped caret at the end of the line is removed without performing line continuation
            • The CALL is aborted without error if any of the following are detected
              • Newly appearing unquoted, unescaped & or |
              • The resultant command token begins with unquoted, unescaped (
              • The very first token after the removed CALL began with @
            • If the resultant command is a seemingly valid IF or FOR, then execution will subsequently fail with an error stating that IF or FOR is not recognized as an internal or external command.
            • Of course the CALL is not aborted in this 2nd round of phase 2 if the resultant command token is a label beginning with :.
        • If the resultant command token is CALL, then restart Phase 6 (repeats until no more CALL)
        • If the resultant command token is a batch script or a :label, then execution of the CALL is fully handled by the remainder of Phase 6.
          • Push the current batch script file position on the call stack so that execution can resume from the correct position when the CALL is completed.
          • Setup the %0, %1, %2, ...%N and %* argument tokens for the CALL, using all resultant tokens
          • If the command token is a label that begins with :, then
            • Restart Phase 5. This can impact what :label is CALLed. But since the %0 etc. tokens have already been setup, it will not alter the arguments that are passed to the CALLed routine.
            • Execute GOTO label to position the file pointer at the beginning of the subroutine (ignore any other tokens that may follow the :label) See Phase 7 for rules on how GOTO works.
              • If the :label token is missing, or the :label is not found, then the call stack is immediately popped to restore the saved file position, and the CALL is aborted.
              • If the :label happens to contain /?, then GOTO help is printed instead of searching for the :label. The file pointer does not move, such that code after the CALL is executed twice, once in the CALL context, and then again after the CALL return. See Why CALL prints the GOTO help message in this script?And why command after that are executed twice? for more info.
          • Else transfer control to the specified batch script.
          • Execution of the CALLed :label or script continues until either EXIT /B or end-of-file is reached, at which point the CALL stack is popped and execution resumes from the saved file position.
            Phase 7 is not executed for CALLed scripts or :labels.
        • Else the result of phase 6 falls through into phase 7 for execution.

        Phase 7) Execute: The command is executed

        • 7.1 - Execute internal command - If the command token is quoted, then skip this step. Otherwise, attempt to parse out an internal command and execute.
          • The following tests are made to determine if an unquoted command token represents an internal command:
            • If the command token exactly matches an internal command, then execute it.
            • Else break the command token before the first occurrence of + / [ ] <space> <tab> , ; or =
              If the preceding text is an internal command, then remember that command
              • If in command line mode, or if the command is from a parenthesized block, IF true or false command block, FOR DO command block, or involved with command concatenation, then execute the internal command
              • Else (must be a stand-alone command in batch mode) scan the current folder and the PATH for a .COM, .EXE, .BAT, or .CMD file whose base name matches the original command token
                • If the first matching file is a .BAT or .CMD, then goto 7.3.exec and execute that script
                • Else (match not found or first match is .EXE or .COM) execute the remembered internal command
            • Else break the command token before the first occurrence of . \ or :
              If the preceding text is not an internal command, then goto 7.2
              Else the preceding text may be an internal command. Remember this command.
            • Break the command token before the first occurrence of + / [ ] <space> <tab> , ; or =
              If the preceding text is a path to an existing file, then goto 7.2
              Else execute the remembered internal command.
          • If an internal command is parsed from a larger command token, then the unused portion of the command token is included in the argument list
          • Just because a command token is parsed as an internal command does not mean that it will execute successfully. Each internal command has its own rules as to how the arguments and options are parsed, and what syntax is allowed.
          • All internal commands will print help instead of performing their function if /? is detected. Most recognize /? if it appears anywhere in the arguments. But a few commands like ECHO and SET only print help if the first argument token begins with /?.
          • SET has some interesting semantics:
            • If a SET command has a quote before the variable name and extensions are enabled
              set "name=content" ignored --> value=content
              then the text between the first equal sign and the last quote is used as the content (first equal and last quote excluded). Text after the last quote is ignored. If there is no quote after the equal sign, then the rest of the line is used as content.
            • If a SET command does not have a quote before the name
              set name="content" not ignored --> value="content" not ignored
              then the entire remainder of the line after the equal is used as content, including any and all quotes that may be present.
          • An IF comparison is evaluated, and depending on whether the condition is true or false, the appropriate already parsed dependent command block is processed, starting with phase 5.
          • The IN clause of a FOR command is iterated appropriately.
            • If this is a FOR /F that iterates the output of a command block, then:
              • The IN clause is executed in a new cmd.exe process via CMD /C.
              • The command block must go through the entire parsing process a second time, but this time in a command line context
              • ECHO will start out ON, and delayed expansion will usually start out disabled (dependent on the registry setting)
              • All environment changes made by the IN clause command block will be lost once the child cmd.exe process terminates
            • For each iteration:
              • The FOR variable values are defined
              • The already parsed DO command block is then processed, starting with phase 4.
          • GOTO uses the following logic to locate the :label
            • The label is parsed from the first argument token
            • The script is scanned for the next occurrence of the label
              • The scan starts from the current file position
              • If the end of file is reached, then the scan loops back to the beginning of the file and continues to the original starting point.
            • The scan stops at the first occurrence of the label that it finds, and the file pointer is set to the line immediately following the label. Execution of the script resumes from that point. Note that a successful true GOTO will immediately abort any parsed block of code, including FOR loops.
            • If the label is not found, or the label token is missing, then the GOTO fails, an error message is printed, and the call stack is popped. This effectively functions as an EXIT /B, except any already parsed commands in the current command block that follow the GOTO are still executed, but in the context of the CALLer (the context that exists after EXIT /B)
            • See https://www.dostips.com/forum/viewtopic.php?f=3&t=3803 for a more precise description of the rules used for parsing labels.
          • RENAME and COPY both accept wildcards for the source and target paths. But Microsoft does a terrible job documenting how the wildcards work, especially for the target path. A useful set of wildcard rules may be found at How does the Windows RENAME command interpret wildcards?
        • 7.2 - Execute volume change - Else if the command token does not begin with a quote, is exactly two characters long, and the 2nd character is a colon, then change the volume
          • All argument tokens are ignored
          • If the volume specified by the first character cannot be found, then abort with an error
          • A command token of :: will always result in an error unless SUBST is used to define a volume for ::
            If SUBST is used to define a volume for ::, then the volume will be changed, it will not be treated as a label.
        • 7.3 - Execute external command - Else try to treat the command as an external command.
          • If in command line mode and the command is not quoted and does not begin with a volume specification, white-space, ,, ;, = or + then break the command token at the first occurrence of <space> , ; or = and prepend the remainder to the argument token(s).
          • If the 2nd character of the command token is a colon, then verify the volume specified by the 1st character can be found.
            If the volume cannot be found, then abort with an error.
          • If in batch mode and the command token begins with :, then goto 7.4
            Note that if the label token begins with ::, then this will not be reached because the preceding step will have aborted with an error unless SUBST is used to define a volume for ::.
          • Identify the external command to execute.
            • This is a complex process that may involve the current volume, current directory, PATH variable, PATHEXT variable, and or file associations.
            • If a valid external command cannot be identified, then abort with an error.
          • If in command line mode and the command token begins with :, then goto 7.4
            Note that this is rarely reached because the preceding step will have aborted with an error unless the command token begins with ::, and SUBST is used to define a volume for ::, and the entire command token is a valid path to an external command.
          • 7.3.exec - Execute the external command.
        • 7.4 - Ignore a label - Ignore the command and all its arguments if the command token begins with :.
          Rules in 7.2 and 7.3 may prevent a label from reaching this point.

        Command Line Parser:

        Works like the BatchLine-Parser, except:

        Phase 1) Percent Expansion:

        • No %*, %1 etc. argument expansion
        • If var is undefined, then %var% is left unchanged.
        • No special handling of %%. If var=content, then %%var%% expands to %content%.

        Phase 3) Echo the parsed command(s)

        • This is not performed after phase 2. It is only performed after phase 4 for the FOR DO command block.

        Phase 5) Delayed Expansion: only if DelayedExpansion is enabled

        • If var is undefined, then !var! is left unchanged.

        Phase 7) Execute Command

        • Attempts to CALL or GOTO a :label result in an error.
        • As already documented in phase 7, an executed label may result in an error under different scenarios.
          • Batch executed labels can only cause an error if they begin with ::
          • Command line executed labels almost always result in an error

        Parsing of integer values

        There are many different contexts where cmd.exe parses integer values from strings, and the rules are inconsistent:

        • SET /A
        • IF
        • %var:~n,m% (variable substring expansion)
        • FOR /F "TOKENS=n"
        • FOR /F "SKIP=n"
        • FOR /L %%A in (n1 n2 n3)
        • EXIT [/B] n

        Details for these rules may be found at Rules for how CMD.EXE parses numbers


        For anyone wishing to improve the cmd.exe parsing rules, there is a discussion topic on the DosTips forum where issues can be reported and suggestions made.

        Hope it helps
        Jan Erik (jeb) - Original author and discoverer of phases
        Dave Benham (dbenham) - Much additional content and editing

    4. Find flash drive
      1. for %%g in (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST "%%g:\DoNotDeleteFlash4291phIr_Wn.txt" SET zdrive=%%g:
    5. Wireless Mode: Am I connected to 2.4GHz or 5.2GHz?
      1. Channel 1 to 11 in USA = 2.4GHz.
        Channel 36 or greater = 5.2Ghz
        C:\Windows\System32\cmd.exe /k C:\Windows\System32\netsh.exe wlan show interfaces
      readme18_files/0039.jpg screenshot of Channel to 11 = 2.4GHz. Channel 36 or greater = 5.2Ghz desktop shortcut cmd.exe /k C:\Windows\System32\netsh.exe wlan show interfacesreadme18_files/0038.jpg Radio Type. date standard set. throughput.readme18_files/0040.jpg Apartment 213 throughput.
    6. Rename file
      1. Remove first 3 characters of all file name. This cracks on periods.
        rename "*" "///*"
    7. Remove duplicate lines with windir\jsort.bat
      jsort file.txt /u >file.txt.new
    8. MAKE FILES FOR TESTING
      1. # BEGIN CMD MAKE FILES FOR TESTING.for %g in (FileGroup000000159.txt,FileGroup000000160.txt,FileGroup000000161.txt,FileGroup000000162.txt,FileGroup000000163.txt,FileGroup000000164.txt,FileGroup000000165.txt) do echo > %g #  END CMD MAKE FILES FOR TESTING.
      2. # BEGIN CMD MAKE FILES FOR TESTING.for /f "tokens=*" %g in (file.txt) do echo > %g file.txt = FileGroup000000159.txtFileGroup000000160.txtFileGroup000000161.txtFileGroup000000162.txtFileGroup000000163.txtFileGroup000000164.txtFileGroup000000165.txt#  END CMD MAKE FILES FOR TESTING.
    9. Yesterday in mmddyy format by cmd and powershell at stackoverflow
      1. For /F %%# In ('PowerShell -NoP "(Get-Date).AddDays(-1).ToString('MM/dd/yy')"') Do Set "zYesterDay=%%#"  
        Echo(%zYesterDay%
      2. "The opening parenthesis directly following Echo is not read as a character, it is simply the best character to use to prevent an 'echo is off' error should the variable be undefined, (empty)"
    10. disable /enable wireless adapter w/ devcon
      1. C:\Windows\devcon64.exe disable "USB\VID_148F&PID_3072&REV_0101"
      2. C:\Windows\devcon64.exe enable "USB\VID_148F&PID_3072&REV_0101"
      3. Get the hardware id of the wireless adapter
        1. hardware id of wireless adapter screenshot of device manager
    11. Display printer preferences. remove unwanted whitespace from command.
      1. You can list the printers and find the default, then initiate the command.:
        for /f "tokens=1*" %%a in ('wmic printer get name^, default ^| find /i "TRUE"') do echo "%%~b"

        The above simply lists the default, where the below code will do what you manually typed in your example:
        for /f "tokens=1*" %%a in ('wmic printer get name^, default ^| find /i "TRUE"') do rundll32 printui.dll,PrintUIEntry /e /n %%~b

        you might experience unwanted spaces in the code, then just assign a variable and replace multiple whitespace with none.
        for /f "tokens=1*" %%a in ('wmic printer get name^, default ^| find /i "TRUE"') do (
        set printer=%%brundll32 printui.dll,PrintUIEntry /e /n "%printer: =%"
        )
    12. Display a random selection of 20 files from a list of files you create. Create a list of shortcuts:
      1. @echo off dir /b /a-d | findstr /n "lnk" >listREM get the total number of filesfor /f %%n in ('type list ^| find /c /v ""') do set total=%%nREM Begin debugREM set totalREM pause REM   End debugREM pick random filessetlocal EnableDelayedExpansionfor /l %%n in (1 1 20) do (set /a number=!random!*total/32768+1REM Begin debugREM set numberREM pause REM   End debugfor /f "tokens=1* delims=:" %%a in ('findstr "!number!:" "list"') do echo %%b)del listREM 
    13. How to not overload the cpu.
      1. stackoverflow search = [batch-file]+processor+core
      2. stackoverflow search = cmd+cpu+load
      3. Multithreaded Windows FOR batch command
    14. FOR IN DO - CREATE FILES for batch file testing
      1. FILE.TXT =
        aaa.binaaa.cuebbb.binbbb.cueccc.binccc.cue
      2. BATCH =
        for /f %%a in (file.txt) do cd.>%%a
        for /f %a in (file.txt) do cd.>%a
    15. for in do pull username and password from text file superuser 1500478
      1. file.txt =
        Combo: testing123mail@gmail.com:passwordAs Combo: abcdefghijklmnopqrstuvwxyz@gmail.com:ajfbdfsome text heresome more text hereAs Combo: hadvsfhia@ahfjbadj.com:password@1some random text hereiloveu@gmail.com:passypassyword123goldenmammy@hotmail.com:youtube123
      2. batch =
        @echo offsetlocal enabledelayedexpansionset "_log=.\mail.txt"cmd /v /c cd.>!_log!for /f "tokens=* delims=" %%i in ('type .\file.txt')do echo/%%~i|find "@" >nul && (for /f "tokens=1-3 delims=:" %%I in ('echo/%%~i')do echo/%%~I|find "@" >nul && (set "_m_p=%%~I:%%~J")||set "_m_p=%%~J:%%~K")&& for %%E in ("%%~J")do >>!_log! (echo/!_m_p: =!|find "@")
      3. mail.txt =
        testing123mail@gmail.com:passwordabcdefghijklmnopqrstuvwxyz@gmail.com:ajfbdfhadvsfhia@ahfjbadj.com:password@1iloveu@gmail.com:passypassyword123goldenmammy@hotmail.com:youtube123
    16. process video for web production.bat
    17. process video for web production.txt
    18. windir\_61.bat
      1. A WINDOWS XP HOME 32-BIT THROUGH WINDOWS 10 PRO 64-BIT BATCH FILE TO SECURE AND BACKUP WINDOWS.

  33. POWERSHELL (Top)
    1. regex
      1. Sum and average a text file; Do not include lines that only contain 0: Get line w/ 160 but not line with 0
        1. See flashdrive\downloads\104.psm1
          1. $z2=(get-content $env:userprofile\downloads\$zname`lasttime.txt) -notmatch '(?<!\d)0(?!\d)' ; # gc of all lines that does not have only 0 i.e. Get 160 but not 0.$z=[math]::Ceiling(($z2 | measure -sum | % sum) / [int]$z2.count) ; write-output "`n   Average seconds needed: $z"
      2. edit html tag
        1. Replace <data-pf..........> with <data-pf>
          $z = gc 2.html$z -replace ' data-pf(.+?)>', '>' | sc 2.html
      3. edit multiple html tags
        1. Replace <data-pf..........> with <data-pf> and replace <em..........> with <em>
          $z = gc 2.html$z -replace ' data-pf(.+?)>', '>' -replace '<em(.+?)>', <em> | sc 2.html
    2. powershell 5.1
      1. GCI / DIR
        1. equivalent of dir /b if all you want is name.ext
          1. gci *.txt,* -name
          2. everything else
            (gci *.pdf).name(gci *.pdf).extensiongci *.pdf | % Name #name.extgci *.pdf | % extension #extgci *.pdf | % basename #namegci *.pdf | % fullname #fqpn
          3. Another dir /b
            1. foreach($file in gci *){  foreach ($line in $file){  $file.Name  $file.baseName  $file.fullName  }}        
            2. Function DisplayInBytes($num) {$suffix = "B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"; $index = 0 ;while ($num -gt 1kb){$num = $num / 1kb;$index++};"{0:N1} {1}" -f $num, $suffix[$index]};foreach ($file in gci *){  foreach ($line in $file){  write-output "  Name = $($file.Name)   Size = $(DisplayInBytes $file.length)"  }}        
        2. Sort by lastaccesstime ascending, display lastwritetime, basename, name, in table that wraps. Not particularly helpful. Files I have not accessed in years are marked accessed 10 days ago.
          Function z{Param([string[]]$path,[int]$numberDays)$cutOffDate = (Get-Date).AddDays(-$numberDays)Get-ChildItem -Path $path |Where-Object {$_.LastAccessTime -le $cutOffDate}}z -path F:\xampp\htdocs\dfellows.rf.gd\htdocs\site_html -numberDays 10 | select name, lastaccesstime | sort LastAccessTime 
        3. Sort by lastwritetime ascending, display lastwritetime, basename, name, fullname in table that wraps
          gci *.lnk | Sort lastwritetime | Select-Object lastwritetime,baseName | Format-Table -Wrap
        4. Sort by lastwritetime descending, display lastwritetime, basename, name, fullname in table that wraps
          gci *.lnk | Sort lastwritetime -descending | Select-Object lastwritetime,baseName | Format-Table -Wrap
        5. folder size in MB
          1. "{0} MB" -f ((Get-ChildItem | Measure-Object -Property Length -Sum -ErrorAction Stop).Sum / 1MB)
        6. count in folder
          1. files:(gci -file).countfile and folders - recurse(gci -recurse).count
      2. gci
        1. Get *.mp4 in current directory and ytsearch directory
          1. Get-ChildItem *.mp4,ytsearch | Where-Object { ( $_.creationtime -ge $zstart ) }
        2. Read file line x into memory
          1. use [System.IO.File]::ReadAllLinesfor large files.
            [0] gets line one, [1] gets line two and so on.
             # $zStartNFL = ([System.IO.File]::ReadAllLines( "$zdrive\downloads\DoNotDelete\$zScriptName$($z5)start.txt" ))[0];  # $zStartNFL = (gc "j:\downloads\DoNotDelete\103.txtNFLstart.txt")[0];           
      3. Files: Working with files
        1. Progress bar
          1. # https://jordantheitguy.com/2019/06/24/how-to-powershell-progress-bars/$Contents = gci -Path "$zdrive\downloads\downloads" -file;$Destination = "$env:userprofile\downloads";foreach($Item in $Contents){Move-Item -path $Item.FullName -Destination $Destination[int]$currentItem = [array]::indexof($Contents,$Item)Write-Progress -Activity "Moving files" -Status "Moving - $($Item.Name) - File $($currentItem) of $($Contents.Count - 1) $([math]::round((($currentItem + 1)/$Contents.Count),2) * 100)% " -PercentComplete $([float](($currentItem + 1)/$Contents.Count) * 100)Start-Sleep -Seconds 1 }                          
        2. Append .extension to file
          1. $z='.mp4'gci * -file -exclude *.* | Rename-Item -NewName { $_.BaseName + $z } -WhatIf
        3. Removing illegal / problematic characters from file name
          1. All of these characters should be escaped with a backslash when using a regex in PowerShell:
            1. \\ \^ \$ \* \+ \? \period \( \) \| \{ \} \[ \]
              gci $zdrive\downloads\downloads -file | Rename-Item -NewName {$_.name -replace "'",""} ; # Remove apostrophegci $zdrive\downloads\downloads -file | Rename-Item -NewName {$_.name -replace "\[",""};gci $zdrive\downloads\downloads -file | Rename-Item -NewName {$_.name -replace "\]",""};gci $zdrive\downloads\downloads\* -File -Include *.*.* | Rename-Item -NewName { ($_.BaseName -replace '\.') + $_.Extension }; # Remove period from basename 
      4. Move files from flash drive to Downloads.
        1. Move files from flash drive to Downloads.
          1. # Move files from flash drive to Downloads.# Find flash drive by searching DriveType 2 for text file.# Strip file name of characters that cause CMD to choke.(Get-WmiObject Win32_Volume -f {Label='Verbatim' and DriveType='2'}).name|foreach-object{if(test-path $_'\DoNotDeleteFlash4291phIr_Wn.txt'){$zdrive="$_"}} ; # Removing illegal / problematic characters from file name;
            # "All of these characters should be escaped with a backslash when using a regex in PowerShell: \\ \^ \$ \* \+ \? \period \( \) \| \{ \} \[ \] "
            gci $zdrive\downloads\downloads -file | Rename-Item -NewName {$_.name -replace "'",""} ; # Remove apostrophe
            # sleep -m 500 ;
            gci $zdrive\downloads\downloads -file | Rename-Item -NewName {$_.name -replace "\[",""};
            # sleep -m 500 ;
            gci $zdrive\downloads\downloads -file | Rename-Item -NewName {$_.name -replace "\]",""};
            # sleep -m 500 ;
            gci * -File -Include *.*.* | Rename-Item -NewName { ($_.BaseName -replace '\.') + $_.Extension }; # Remove period from basename# Create shortcut to this script # Windows 10 does not know PowerShell variables; it knows CMD variables. Shortcuts containing variables must use CMD variables.# C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit %zmyapps1%\WINDOWS\107.ps1# How to move files with CMD # C:\Windows\System32\cmd.exe /k FOR /f "tokens=*" %g in ('dir /b "j:\downloads\downloads\*.*" ') do move /y "J:\downloads\downloads\%g" %userprofile%\downloads\
      5. Working with Unicode (non-ASCII range) characters
        1. Working with Unicode (non-ASCII range) characters
          1. in Powershell, not Powershell Core, requires a script to be encoded using a Unicode character encoding. It is a good habit to routinely save all PowerShell scripts (source code) as UTF-8 with BOM, because that ensures that they are interpreted the same irrespective of any given PC system locale. See stackoverflow/a/55053609
      6. Find flash drive
        1. # BEGIN Find flash drive( Get-WmiObject Win32_Volume -Filter {DriveType='2'} ).name | % { if ( test-path $_'\DoNotDeleteFlash4291phIr_Wn.txt' ) { $zdrive="$_"} } ; # Set flashdrive drive letter by looking for text file on removable drives ; Trim backslash:$zdrive=$zdrive.Trim("\") ;# $z = @('D:','E:','F:','G:','H:','I:','J:','K:','L:','M:','Z:') $z|foreach-object{if(test-path $_'\DoNotDeleteFlash4291phIr_Wn.txt'){$zdrive="$_"}} ; Trim colon:$zdrive.Trim(":") ;CMD: 				    for %%g in (D E F G H I J K L M) DO IF EXIST "%%g:\DoNotDeleteFlash4291phIr_Wn.txt" SET zdrive=%%g:#   END Find flash drive 
      7. Write to file
        1. Write to file line one, line two and so on
          1. "$zStartNFL`n$zFinishNFL`n$zStartNHL`n$zFinishNHL`n$zStartMLB`n$zFinishMLB`n#NFL, NHL and MLB start / end date." | out-file "$zdrive\Downloads\DoNotDelete\$zscriptname$($z5)start.txt" ;
      8. Remove user created, current session variables excluding pwd, *preference. Silence errors with -erroraction 0
        gv -Exclude pwd,*preference | rv -ea 0
      9. ~equivalent of set
        ls env:
        gci Env:* | Sort-Object Name | ft -h      (format-table   hide headers)
        gv
        See get-help gv
      10. get-date
        1. Copy / paste file created timestamp from Windows explorer gui failure:
          1. Paste into powershell 5.1 and remove invisibile character/s which show up as question mark/s.
            1. Sunday, ?August ?29, ?2021, ??9 : 12 : 11 AM
          2. When copy / paste into powershell_ise and run the error message is:
            1. Cannot convert value "Sunday, ‎August ‎29, ‎2021, ‏‎9 : 12 : 11 AM" to type "System.DateTime". Error: "String was not recognized as a valid DateTime."
            get-date "Sunday, ‎August ‎29, ‎2021, ‏‎9 : 12 : 11 AM"Cannot convert value "Sunday, ‎August ‎29, ‎2021, ‏‎9 : 12 : 11 AM" to type "System.DateTime". Error: "String was not recognized as a valid DateTime."
          3. When copy / paste into Notepad++ and run as a Powershell script the error message is:
            1. Cannot convert value "Sunday, ‎August ‎29, ‎2021, ‏‎9 : 12 : 11 AM"to type "System.DateTime". Error: "The string was not recognized as a valid DateTime."
              get-date "Sunday, ‎August ‎29, ‎2021, ‏‎9 : 12 : 11 AM"Cannot convert value "Sunday, ‎August ‎29, ‎2021, ‏‎9 : 12 : 11 AM" to type "System.DateTime". Error: "The string was not recognized as a valid DateTime."
          4. When copy / paste into notepad++ and view all characters is selected the invisibile characters do not show up.
          5. Copy and paste explorer file created timestamp
          6. copy paste file explorer timestamp
          7. copy paste explorer file timestamp
          8. copy paste file timestamp
        2. Find file by creationtime / lastwritetime / ... use "-like"
          1. Find file by creationtime / lastwritetime / ... use either "-like" or "$_.creationtime -gt $zstart -and $_.CreationTime -lt $zend"
            $zstart=$(Get-Date "8/29/2021 9  :  12  :  10 AM")$zequal=$(Get-Date "8/29/2021 9  :  12  :  11 AM")$zend=$(Get-Date "8/29/2021 9  :  12  :  12 AM")$arr = @(gci -file | Sort-Object creationtime | Where-Object {$_.creationtime -like $zequal})$arr = @(gci -file | Sort-Object creationtime | Where-Object {$_.creationtime -gt $zstart -and $_.CreationTime -lt $zend})
        3. SORT BY DATE MODIFIED: HOW TO MODIFY FILE "SORT BY DATE MODIFIED" PROPERTY
          # BEGIN HOW TO MAKE FILES WHOSE BASENAME INCLUDES _24_ THE OLDEST.# AddHours(-8) = *_24_*# AddHours(-7) = *_25_*# AddHours(-6) = *_26_*$z=(Get-Date).AddHours(-8) ;$arr = @(gci * -Include '*_24_*')$arr | ForEach {$z = $z.addSeconds(-60) ; $_.LastWriteTime = $z ;}#    END HOW TO MAKE FILES WHOSE BASENAME INCLUDES _24_ THE OLDEST.
        4. In the past: get-date 6 hours 34 minutes 6 seconds in the past
          1. (Get-Date).AddHours(-6).AddMinutes(-34).AddSeconds(-6)
        5. In the future: get-date 6 hours 34 minutes 6 seconds in the future
          1. (Get-Date).AddHours(6).AddMinutes(34).AddSeconds(6)
        6. 5:30:45 PM
          1. (get-date -f T) -replace "  :  ",":"
          2. Format pattern   Description
            d 12/7/2020 ShortDatePattern
            D Monday, December 7, 2020 LongDatePattern
            f Monday, December 7, 2020 5 : 49 PM Full date and time (long date and short time)
            F Monday, December 7, 2020 5 : 49 : 55 PM FullDateTimePattern (long date and long time)
            g 12/7/2020 5 : 50 PM General (short date and short time)
            G 12/7/2020 5 : 50 : 14 PM General (short date and long time)
            m, M December 7 MonthDayPattern
            o, O   Round-trip date/time pattern; with this format pattern, the formatting or parsing operation always uses the invariant culture
            r, R   RFC1123Pattern; with this format pattern, the formatting or parsing operation always uses the invariant culture
            s   SortableDateTimePattern (based on ISO 8601) using local time;
            with this format pattern, the formatting or parsing operation always uses the invariant culture
            t   ShortTimePattern
            T   LongTimePattern
            u   UniversalSortableDateTimePattern using the format for universal time display; with this format pattern, the formatting or parsing operation always uses the invariant culture
            U   Full date and time (long date and long time) using universal time
            y, Y   YearMonthPattern
             
      11. equivalent of cmd "if not errorlevel 1"
        $Files = @(gci *.mp3) if ($Files.length -ne 0) { write-host "   .mp3 found."}else{ write-host "    No .mp3 found."}
      12. Scriptblock: Get variable value out of a scriptblock
        1. $scriptblock ={    $filename = 'D:\profile\test\summary.txt'    $filename2 = 'e:\profile\test\summary.txt'    $filename # this feeds $result[0]    $filename2 # this feeds $result[1]}$result = Invoke-Command -ScriptBlock $scriptblock $result[0]$result[1]Results:D:\profile\test\summary.txte:\profile\test\summary.txt
      13. Scriptblock: Pass argument/s to a scriptblock
        1. $zstart=$(get-date) ;$zinput='public' ;$zdrive='J:' ;$zblock ={   param($zstart, $zinput, $zdrive)  "arg1 is $zstart"  "arg2 is $zinput"  "arg3 is $zdrive"}&$zblock $zstart $zinput $zdrive
      14. INPUT WITH WINDOWS.FORMS
        1. 4 INPUT SET TO 4 VARIABLES
          1. function zInput1 ($title,$z1, $z2, $z3,$z4) {# https://techwizard.cloud/2014/03/11/powershell-custom-gui-input-box-for-passing-values-to-variables/[void][System.Reflection.Assembly]::LoadWithPartialName( "System.Windows.Forms") ;[void][System.Reflection.Assembly]::LoadWithPartialName( "Microsoft.VisualBasic") ;$form = New-Object "System.Windows.Forms.Form";$form.Width = 500;$form.Height = 200;$form.Text = $title;$form.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterScreen;$textLabel1 = New-Object "System.Windows.Forms.Label";$textLabel1.Left = 25;$textLabel1.Top = 15;$textLabel1.Text = $z1;$textLabel2 = New-Object "System.Windows.Forms.Label";$textLabel2.Left = 25;$textLabel2.Top = 50;$textLabel2.Text = $z2;$textLabel3 = New-Object "System.Windows.Forms.Label";$textLabel3.Left = 25;$textLabel3.Top = 85;$textLabel3.Text = $z3;$textLabel4 = New-Object "System.Windows.Forms.Label";$textLabel4.Left = 25;$textLabel4.Top = 120;$textLabel4.Text = $z4;$textBox1 = New-Object "System.Windows.Forms.TextBox";$textBox1.Left = 150;$textBox1.Top = 10;$textBox1.width = 200;$textBox2 = New-Object "System.Windows.Forms.TextBox";$textBox2.Left = 150;$textBox2.Top = 50;$textBox2.width = 200;$textBox3 = New-Object "System.Windows.Forms.TextBox";$textBox3.Left = 150;$textBox3.Top = 90;$textBox3.width = 200;$textBox4 = New-Object "System.Windows.Forms.TextBox";$textBox4.Left = 150;$textBox4.Top = 130;$textBox4.width = 200;$defaultValue = "" ;$textBox1.Text = $defaultValue;$textBox2.Text = $defaultValue;$textBox3.Text = $defaultValue;$textBox4.Text = $defaultValue;$zInput1 = New-Object "System.Windows.Forms.Button";$zInput1.Left = 360;$zInput1.Top = 85;$zInput1.Width = 100;$zInput1.Text = "Ok";$eventHandler = [System.EventHandler]{$textBox1.Text;$textBox2.Text;$textBox3.Text;$textBox4.Text;$form.Close();};$zInput1.Add_Click($eventHandler) ;$form.Controls.Add($zInput1);$form.Controls.Add($textLabel1);$form.Controls.Add($textLabel2);$form.Controls.Add($textLabel3);$form.Controls.Add($textLabel4);$form.Controls.Add($textBox1);$form.Controls.Add($textBox2);$form.Controls.Add($textBox3);$form.Controls.Add($textBox4);$ret = $form.ShowDialog();return $textBox1.Text, $textBox2.Text, $textBox3.Text, $textBox4.Text;} <# End of function #>$return= zInput1 "NFL and NHL start and end dates in mm/dd/yyyy format." "NFL start:" "NFL end:" "NHL start:" "NHL end:";$Script:zNflStart=$return[0];$Script:zNflEnd=$return[1];$Script:zNhlStart=$return[2];$Script:zNhlEnd=$return[3];write "NFL start is: $zNflStart" ;write "NFL end is: $zNflEnd" ;write "NHL start is: $zNhlStart" ;write "NHL end is: $zNhlEnd" ;"$zNflStart`n$zNflEnd`n$zNhlStart`n$zNhlEnd`n#NFL and NHL start / end date. Used by 103.txt and 103.psm1" | out-file "$zdrive\Downloads\DoNotDelete\$zscriptname$($z5)start.txt" ;
      15. INPUT WITH WINDOWS.MESSAGEBOX
        1. Yes: do one thing. No: do another thing.
          1. Add-Type -AssemblyName PresentationFramework ;# $zarr = @(gci $env:userprofile\downloads\_3videos\temp -file) ; # Create an array of files to download. See below.$zarr = @(gci $env:userprofile\downloads\_3videos\temp -file | Where-Object {($_.creationtime -ge $zstart)} | Sort-Object creationtime -descending) ; switch (  [System.Windows.MessageBox]::Show(    'Would you like to move files to flashdrive\downloads\downloads??',    'QUESTION',    'YesNo',    'QUESTION'  )) {  'Yes' {# $zarr | % {$_}$zarr | % {move-item $env:userprofile\downloads\_3videos\temp\$_ $zdrive\downloads\downloads -force ;while (!(Test-Path "$zdrive\downloads\downloads\$_")) { Start-Sleep 1 }}&$zdrive\Downloads\DESKTOPREFRESH ;} ; # END Yes  'No' {$zarr | % {move-item $env:userprofile\downloads\_3videos\temp\$_ $env:userprofile\downloads\_3videos -force ;while (!(Test-Path "$env:userprofile\downloads\_3videos\$_")) { Start-Sleep 1 }&$zdrive\Downloads\DESKTOPREFRESH ;  }  } ; # END No} ; # END Switchexit ;
      16. IS BETWEEN DATE
        1. Function IsBetweenDates ([Datetime]$start,[Datetime]$end){  $d = get-date ; if (($d -ge $start) -and ($d -le $end)){return $true ;}else{return $false ;}} <# End of function #># if (IsBetweenDates "$zNflStart 12:00:00 AM" "$zNflEnd 12:00:00 PM"){}
      17. Combine / concatenate text files
        1. gc K:\Downloads\DoNotDelete\archive.txt,C:\Users\_56\AppData\Local\Temp\DoNotDelete\archive.txt | out-file -encoding ascii combine.txt
      18. Youtube-dl: Combine archive.txt files; Remove duplicate entries. Remove "tab tab space"?
        1. i do not know yet if "tab tab space" is created by youtube-dl
          1. (gc K:\Downloads\DoNotDelete\archive.txt,C:\Users\_56\AppData\Local\Temp\DoNotDelete\archive.txt) -replace '\t\t ','' | sort | get-unique | out-file -encoding ascii combine.txt
          2. # youtube-dl archive lists: Find unique, output to file and copy# C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -ExecutionPolicy Bypass gc "F:\MYAPPS\WINDOWS\102.ps1"|powershell(gc "F:\Users\_9doug\AppData\Local\Temp\DoNotDelete\archive.txt","J:\Downloads\DoNotDelete\archive.txt","Z:\DoNotDeleteArchive.txt") | sort | get-unique | out-file -encoding ascii "combine.txt"copy combine.txt "F:\Users\_9doug\AppData\Local\Temp\DoNotDelete\archive.txt"copy combine.txt "J:\Downloads\DoNotDelete\archive.txt"copy combine.txt "Z:\DoNotDeleteArchive.txt"
      19. Youtube-dl: Combine archive.txt files; Remove "tab tab space"?
        1. i do not know yet if "tab tab space" is created by youtube-dl
          1. (gc K:\Downloads\DoNotDelete\archive.txt,C:\Users\_56\AppData\Local\Temp\DoNotDelete\archive.txt) -replace '\t\t ','' | sort | get-unique | out-file -encoding ascii combine.txt
      20. Get shortcut properties
        function Get-StartMenuShortcuts{    $Shortcuts = Get-ChildItem $env:USERPROFILE\Desktop -Include *.lnk    $Shell = New-Object -ComObject WScript.Shell    foreach ($Shortcut in $Shortcuts)    {        $Properties = @{        ShortcutName = $Shortcut.Name;        ShortcutFull = $Shortcut.FullName;        ShortcutPath = $shortcut.DirectoryName        Target = $Shell.CreateShortcut($Shortcut).targetpath        }        New-Object PSObject -Property $Properties    }[Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | Out-Null}$Output = Get-StartMenuShortcuts$Output.Target$Output.shortcutname$Output.shortcutFull
      21. Concatenate .mp4 with Windows 10 64-bit, powershell 5 and ffmpeg using intermediate .ts file. With comments.
        # Concatenate .mp4 with Windows 10 64-bit, powershell 5 and ffmpeg using intermediate .ts file# get sample .mp4 https://www.vjloops.com/stock-video/circle-flow-offsets-01-138855.html# BEGIN PREP$ErrorActionPreference="SilentlyContinue" ; # $ErrorActionPreference = "Continue" ;$z=Get-Date -f 'MMddyy-hhmmss';ni -ItemType Directory "$z" > $null ;# make copies of .mp4 1..3 | foreach { copy-item 1.mp4 "$z\$_.mp4" > $null}#   END PREP# BEGIN CONCATENATE # copy .mp4 to .tsforeach ($i in gci "$z\*.mp4" | % basename) {ffmpeg -y -i "$z\$i.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts "$z\$i.ts"}# http://trac.ffmpeg.org/wiki/Concatenate# Create ASCII list of files for ffmpeg -i input in format "file 'directory\name' = file '081721-015117\3.ts'remove-item "$z\list3.txt" # next line out-file must use -append AND must use -Encoding ASCIIforeach ($i in gci "$z\*.mp4" | % name) {echo "file '$z\$i'" | out-file "$z\list3.txt" -append -Force -Encoding ASCII}# http://trac.ffmpeg.org/wiki/Concatenate&ffmpeg -y -f concat -safe 0 -i "$z\list3.txt" "$env:userprofile\desktop\NotifyAnimation.mp4"# reduce quality from default of 23 to 30. 51= worst 0 = best.#&ffmpeg -y -f concat -safe 0 -i "$z\list3.txt" -crf 30 "$env:userprofile\desktop\NotifyAnimation.mp4"#&ffmpeg -y -f concat -safe 0 -i "$z\list3.txt" -crf 40 "$env:userprofile\desktop\NotifyAnimation.mp4"#   END CONCATENATE#CLEAN UPri "$z" -Recurse -confirm
      22. Send text or email
        1. Gmail account must be set to "Use less secure app".
        2. "Use less secure app" is turned off by google w/o notification.
        3. If you send a message without a picture, video, emoji, etc., it goes out SMS. Otherwise it goes out MMS. Email is typically faster and can carry more information but is not as interactive.
        4. html in the body sent to mms.att.net renders correctly but is removed from the body and placed in an attachment.
        5. html in the body sent to vmpix.com renders as one string no whitespace text.
        6. list of sms & mms servers
          • AT&T: number@txt.att.net (SMS), number@mms.att.net (MMS)
          • Verizon: number@vtext.com (SMS), number@vzwpix.com (MMS)
          • Virgin Mobile: number@vmobl.com (SMS), number@vmpix.com (MMS)
          • T-Mobile: number@tmomail.net (SMS & MMS)
          • Boost Mobile: number@sms.myboostmobile.com (SMS), number@myboostmobile.com (MMS)
          • C-Spire: number@cspire1.com
          • Consumer Cellular: number@mailmymobile.net
          • Cricket: number@sms.cricketwireless.net (SMS), number@mms.cricketwireless.net (MMS)
          • Google Fi (Project Fi): number@msg.fi.google.com (SMS & MMS)
          • Metro PCS: number@mymetropcs.com (SMS & MMS)
          • Mint Mobile: number@mailmymobile.net (SMS)
          • Page Plus: number@vtext.com (SMS), number@mypixmessages.com (MMS)
          • Red Pocket: Red Pocket uses AT&T or T-Mobile (for GSM SIMs) & Verizon for CDMA. See info. for those carriers.
          • Republic Wireless: number@text.republicwireless.com (SMS)
          • Simple Mobile: number@smtext.com (SMS)
          • Sprint: number@messaging.sprintpcs.com (SMS), number@pm.sprint.com (MMS)
          • Ting: number@message.ting.com (SMS for CDMA), number@tmomail.net (SMS for GSM)
          • Tracfone: number@mmst5.tracfone.com (MMS)
          • U.S. Cellular: number@email.uscc.net (SMS), number@mms.uscc.net (MMS)
          • Xfinity Mobile: number@vtext.com (SMS), number@mypixmessages.com (MMS)
        7. https://adamtheautomator.com/send-mailmessage/
        8. to single or multiple recipients. No prompt for account password. Provides username and password.
          $zpass = ConvertTo-SecureString "PasswordGoesHere" -AsPlainText -Force$z = New-Object System.Management.Automation.PSCredential ("dfellows2@gmail.com", $zpass)Send-MailMessage -SmtpServer smtp.gmail.com -Credential $z -UseSsl -From 'dfellows2@gmail.com' -To '2125551212@vmobl.com' -Subject 'This is the subject' -body 'This is the body'
          $zpass = ConvertTo-SecureString "PasswordGoesHere" -AsPlainText -Force$z = New-Object System.Management.Automation.PSCredential ("dfellows2@gmail.com", $zpass)Send-MailMessage -SmtpServer smtp.gmail.com -Credential $z -UseSsl -From 'dfellows2@gmail.com' -To '2125551212@txt.att.net' -Subject 'This is the subject' -body 'This is the body'
          $zpass = ConvertTo-SecureString "PasswordGoesHere" -AsPlainText -Force$z = New-Object System.Management.Automation.PSCredential ("dfellows2@gmail.com", $zpass)Send-MailMessage -SmtpServer smtp.gmail.com -Credential $z -UseSsl -From 'dfellows2@gmail.com' -To @('dfellows2@gmail.com','2125551212@vmobl.com','2125551212@txt.att.net') -Subject 'This is the subject' -body 'This is the body'
        9. html in the body. Best sent by email.
          • html in the body sent to mms.att.net renders correctly but is removed from the body and placed in an attachment.
          • html in the body sent to VirginMobile MMS server vmpix.com renders as "one string no whitespace text".
          $body = @'
          Firstname Lastname Age
          Jill Smith 50
          Eve Jackson 94
          '@# Separate -To addresses w/ apostropes and commas: -To @('xyz2@gmail.com','xyz@juno.com','xyz8@juno.com')$zpass = ConvertTo-SecureString "PasswordGoesHere" -AsPlainText -Force$z = New-Object System.Management.Automation.PSCredential ("dfellows2@gmail.com", $zpass)Send-MailMessage -SmtpServer smtp.gmail.com -Credential $z -UseSsl -From 'dfellows2@gmail.com' -To @('dfellows2@gmail.com') -Subject 'This is the subject' -body $body -BodyAsHtml
        10. Prompts for account password. Provides account username.
          Send-MailMessage -To 'dfellows2@gmail.com' -From 'dfellows2@gmail.com'  -Subject 'test powershell' -Body 'test powershell' -Credential 'dfellows2@gmail.com' -SmtpServer 'smtp.gmail.com' -Port 587 -usessl
        11. Attach one or two files
          Send-MailMessage -To 'dfellows2@gmail.com' -From 'dfellows2@gmail.com'  -Subject 'test powershell' -Body 'test powershell' -Attachments 'C:\file.doc','D:\report.xlsx' -Credential 'dfellows2@gmail.com' -SmtpServer 'smtp.gmail.com' -Port 587 -usessl
        12. attach all files in folder
          Get-ChildItem -Path 'C:\MyFiles' | Send-MailMessage -To 'dfellows2@gmail.com' -From 'dfellows2@gmail.com'  -Subject 'test powershell' -Body 'test powershell' -Credential 'dfellows2@gmail.com' -SmtpServer 'smtp.gmail.com' -Port 587 -usessl
      23. MP4 to MP3: Convert .mp4 that begins with character 'a' to .mp3 using PowerShell 5 and ffmpeg.
        #  Convert .mp4 that begins with character 'a' to .mp3 using PowerShell 5 and ffmpeg.gci a*.mp4 | % { & ffmpeg -y -i $_ -metadata title="$($_.basename).mp3" -metadata album="(1Radio)" -metadata artist="YouTube" -metadata publisher="Youtube" "$($_.basename).mp3"}  ;gci a*.mp4 | % { "$($_.basename).mp3"$($_.basename)"2$($_.name)"} ;
      24. METADATA: Replace -metadata title with file name or basename using PowerShell 5 and ffmpeg.
        #  Replace - metadata title with file name or basename using PowerShell 5 and ffmpeg.# FFmpeg cannot edit existing files in-place.gci | % { & ffmpeg -y -i $_ -metadata title="$($_.name)" -metadata album="Mad Men" -c copy "2$($_.name)"ri $_ ;rename-item 2$_ $_ ;} ;# Another approach$ztimestamp1=Get-Date -f 'ddhhmmss' ;ni -ItemType Directory "$ztimestamp1" -force | OUT-NULL ; # See _57 or _54.txtgci | % { & ffmpeg -y -i $_ -metadata title=$($_.name) -metadata album="Mad Men5" -c copy "$ztimestamp1\$($_.name)"move-item "$ztimestamp1\$($_.name)" $_ -Force ;} ;ri $ztimestamp1 ;
      25. METADATA: Replace -metadata title with file name using PowerShell 5 and ffmpeg.
        #  Replace - metadata title with file basename using PowerShell 5 and ffmpeg.# FFmpeg cannot edit existing files in-place.gci | foreach { $z2=$_.basename ;& ffmpeg -y -i $_ -metadata title="$z2" -metadata album="Introduction to the Old Testament (Hebrew Bible) (RLST 145) Yale University" -metadata artist="Christine Hayes. Professor of Religious Studies in Classical Judaica at Yale University" -metadata publisher="Youtube - Yale Courses" -c copy 2$_ri $_ ;rename-item 2$_ $_ ;} ;
      26. clear-content "$env:temp\ztmp.txt" = Crtl+a delete
      27. delete SUBfolders older than 14 days.
        powershell -command "get-childitem "PATH-TO-ROOT-FOLDER-HERE" |? {$_.psiscontainer -and $_.lastwritetime -lt (get-date).adddays(-14)} |% {remove-item $_ -recurse -force -whatif}" 
      28. REMOVE-ITEM: Can not remove-item because it is in use:
        # you are using "pushd" aren't you? popd before remove-item.popd ;ri -recurse -force $env:userprofile\Downloads\$ztimestamp1 ; # See flash\downloads\_29.ps1
      29. REMOVE EVERY LINE FROM TEXT FILE THAT DOES NOT CONTAIN TEXT1, TEXT2 WITH OR WITHOUT NEWLINE
        1. REMOVE EVERY LINE FROM TEXT FILE THAT DOES NOT CONTAIN TEXT1, TEXT2. OUTPUT W/ OR W/O NEWLINE.
          # REMOVE EVERY LINE FROM TEXT FILE THAT DOES NOT CONTAIN TEXT1, TEXT2. OUTPUT W/ OR W/O NEWLINE.CLS$z=@('doug','$window','$23@','$20','$1+$0','$5.50','$2.19).','$USER:$GROUP','$a')$z|out-file doug.txt(Get-Content doug.txt) | Where-Object { $_ -notmatch 'doug|TEXT1|TEXT2' } | Set-Content doug2.txt;write-output "Contents of doug.txt:";gc doug.txt;write-output "Contents of doug.txt with doug removed:";gc doug2.txt;#
      30. REMOVE ELEMENT FROM ARRAY AND OUTPUT TO TEXT FILE. OUTPUT W/ OR W/O NEWLINE.
        1. REMOVE ELEMENT FROM ARRAY AND OUTPUT TO TEXT FILE W/ OR W/O NEWLINE
          # REMOVE ELEMENT FROM ARRAY AND OUTPUT TO TEXT FILE W/ OR W/O NEWLINECLS$z=@('doug','$window','$23@','$20','$1+$0','$5.50','$2.19).','$USER:$GROUP','$a')write-output "Contents of array:";$z | foreach{Write-Host $_}; # with newline. w/o newline ,$z | foreach{Write-Host $_};write-output "Array with doug removed";$z=$z | foreach{$_ | Where-Object { $_ -notmatch 'doug|TEXT1|TEXT2' }};$z;$z | out-file doug2.txt;write-output "Contents of doug2.txt produced with array:";gc doug2.txt;write-output "";#
      31. Search for a string with select-string that starts with $ in a text file:
        $z=@('doug','$window','$23@','$20','$1+$0','$5.50','$2.19).','$USER:$GROUP','$a')$z|out-file doug.txt(gc doug.txt).Split()| Where-Object {$_ -like "$*"}
        OR
        param(
        [string]$file = "$env:userprofile\Desktop\2.txt",
        [string]$pattern = "$*"
        )
        (Gc $file).Split()| Where-Object {$_ -like $pattern}
      32. Search for a string with select-string that contains $ in a text file:
        $z=@('doug','$window','$23@','$20','$1+$0','$5.50','$2.19).','$USER:$GROUP','$a')$z|out-file doug.txt(gc doug.txt) | select-string -SimpleMatch '$'
        Do not use -raw:
        $z=@('doug','$doug','do$ug','doug$','$USER:$GROUP','$a')$z|out-file doug.txt(gc doug.txt) | select-string -SimpleMatch '$'
      33. Parse a text file of file paths and extract basename from fullname and append the results to a new text file encoded in ascii.
        1. see superuser.com
          file.log:
              Opening track for playback: "D:\Music\musicfile1.m4a"  
          Opening track for playback: "D:\Music\musicfile2.mp3"
          Opening track for playback: "D:\Music\musicfile3.wav"
          Opening track for playback: "D:\Music\musicfile4.mid"
          Opening track for playback: "D:\Music\musicfile5.MINIGSF"
          Opening track for playback: "D:\Music\musicfile6.AIMPPL"
          Opening track for playback: "D:\Music\musicfile7.L"
          Opening track for playback: "D:\Music\musicfile8.ACD-ZIP"
          Opening track for playback: "D:\Music\musicfile.m4a"
          Path to file.log: 
              $HOME\Documents\file.log  
          What I want to extract from the last line: 
              musicfile  
          Long: 
              (Get-Content -Path $HOME\Documents\file.log | Select -Last 1) -match '.+\\([\w\s]+).+'  $matches[1] | out-file $HOME\Documents\file2.log -append -encoding ascii  
          Short: 
              (gc "$HOME\Documents\file.log")[-1] -match '.+\\([\w\s]+).+'  $matches[1] | out-file $HOME\Documents\file2.log -append -encoding ascii  
        2. Without using a regex
              (gc "$HOME\Documents\file.log")[-1].split('"')[1].split('\')[-1].split('.')[0]
      34. Increment LastwriteTime one second for every .lnk in folder, display lastwritetime.
        1. How to sort files in Windows by Date:
          $z=get-dategci *.lnk | ForEach-Object{$_.LastWriteTime = $z$z = $z.addSeconds(1)$_.LastWriteTime}
      35. Replace CreationTime with LastwriteTime using a wildcard
        1. Change / Add extension to match your files. After running the script hit `F5` or you will not see the updated Properties-Details in your files.
          Get-ChildItem *.jpg | ForEach-Object{$_.CreationTime = $_.LastWriteTime}      Get-ChildItem *.mkv | ForEach-Object{$_.CreationTime = $_.LastWriteTime} 
          screenshot of Properties-Details
      36. mAKE 10 DAY OLD DIRECTORIES WITH SUB-DIRECTORY AND FILE.
        # Windows 10 64-bit. Powershell 5.1           # New-item directory\directory name last ten days          pushd $env: userprofile\Desktopforeach($i in -10..-1){$z=(Get-Date).AddDays($i).tostring("MMddyy")ni -itemtype directory "$z\livebolivar.com\New Folder" > $nullni -itemtype file "$z\livebolivar.com\New Folder\test.txt" > $null}popd exit #
      37. remove directory / delete directory
        1. Remove directory, sub-directories, files, sub files:
          ri -Recurse "$env:userprofile\Downloads\_4Documents2" -whatif
      38. remove directory with wildcard
        1. Remove `livebolivar.com` and it's `sub-directories` from ~50 folders in this path:
          "F:\MYAPPS\USERS\_9doug\011220, 011920, 020520, 020620, 020720, 020820, 020920, 021020, 021120, 021220, 021320, 021420, 021520, 021620, 021720, 021820, 021920, 022020, 022120, 022220, 022320, 022420, 022520, 022720, 022820, 022920, 030120, 030220, 030320, 030420, 030520, 030620, 030720, 030820, 030920, 031020, 031120, 031220, 031320, 031420, 111718, 111818, 111918, 112018, 112118, 112218, 112318\livebolivar.com"

          i.e. remove F:\MYAPPS\USERS\_9doug\011920\livebolivar.com
          gci F:\MYAPPS\USERS\_9doug\*\livebolivar.com | % {ri $_.fullname -recurse -force -whatif}
      39. Parse basename to first dot
        1. Parse basename to first dot
          Windows 10 64-bit. PowerShell 5.1 
          Parse basename to first dot. Update X archives with Y files using gci, regex, $Matches, foreach {$_, PadLeft}, Compress-Archive, and Remove-Item.
          Update X archives with Y files using gci, regex, $Matches, foreach {$_ PadLeft}, Compress-Archive, and Remove-Item.   Files and archives are in the same directory. Avg. 29ms to archive 9   text files (48KB) into 3 .zip files on 20 runs. Is there a faster way?
          For testing clear your desktop. There should be no .txt or .zip files on your desktop.  There are 3 Remove-Item without -whatif or -confirm. Makes 9 text files for testing. Credit to rokumaru
          1.1.txt, 1.1.3.txt and 1.txt go in                   FileGroup0000000001.zip  
          11.txt and 11.1.txt goes in FileGroup0000000011.zip
          2.1.3.6.txt, 2.1.3.6.7.txt, 2.1.txt, and 2.txt go in FileGroup0000000002.zip
          Script:
          pushd $env:USERPROFILE\Desktop   
          ni @("1.1.txt", "1.txt", "11.txt", "2.1.3.6.txt", "2.1.txt","2.txt") > $null
          gci *.txt | where BaseName -match "^(\d+)(\.\d+)*$" | group { $Matches[1] } | foreach {
          $dest = 'FileGroup' + $_.Name.PadLeft(10, "0") + ".zip"
          Compress-Archive $_.Group $dest -ea Stop -update ri $_.Group}
          ni @("1.1.3.txt", "11.1.txt", "2.1.3.6.7.txt") > $null
          gci *.txt | where BaseName -match "^(\d+)(\.\d+)*$" | group { $Matches[1] } | foreach {
          $dest = 'FileGroup' + $_.Name.PadLeft(10, "0") + ".zip"
          Compress-Archive $_.Group $dest -ea Stop -update ri $_.Group}
          Read-Host @"
          Delete all FileGroup*.zip is next. There should be nine files in three archives.
          Press enter key to delete all test files "@
          ri FileGroup*.zip clear-variable -name ("Matches", "dest")
          popd
          #
          Parse file path, name, basename with more than one dot with powershell.
      40. make files for testing
        1..5 | % { ni "$env:USERPROFILE\desktop\$_.mkv"} | out-null
      41. MAKE FILES FOR TESTING AND ADD TO ZIPFILE
        # BEGIN POWERSHELL MAKE FILES FOR TESTING. Makes filegroup000000159.txt - 165.txt
        159..165 | ForEach-Object {
        $zippedFile = 'FileGroup{0:000000000}' -f $_
        New-Item -itemtype file -path $env:USERPROFILE\Desktop\$zippedFile.txt
        }
        # END POWERSHELL MAKE FILES FOR TESTING. Makes filegroup000000159.ZIP - ZIP.txt# BEGIN MAKE ZIPFILE stackoverflow
        159..165 | ForEach-Object {
        $zippedFile = 'FileGroup{0:000000000}' -f $_
        Compress-Archive "$env:USERPROFILE\Desktop\$zippedFile.txt" -DestinationPath "$env:USERPROFILE\Desktop\$zippedFile.zip" -forceRemove-item "$env:USERPROFILE\Desktop\$zippedFile.txt" -whatif
        }
        # END MAKE ZIPFILE https://stackoverflow.com/a/60586689/8826818
      42. Delete file older than 180 days
        1. # gci "$zdrive\Downloads\DoNotDelete\$zScriptName$($z5)start.txt" | Where-Object { $_.creationTime -le (get-date).adddays(-180) } | Remove-Item ;# gci "$zdrive\Downloads\DoNotDelete\$zScriptName$($z5)start.txt" | Where-Object { $_.creationTime } | select creationtime ;
      43. Delete all images in folder whose width is not 1920px
        1. Delete all images in folder whose width is not 1920px
          Add-Type -AssemblyName System.Drawing$imagesToDelete = Get-ChildItem . | Where-Object {try { $pic = [System.Drawing.Image]::FromFile($_.FullName)# We only want images that are _not_ 1920px wide$pic.Width -ne 1920}catch{# Ignore errors (== probably not an image)}finally {# Clean upif($pic -is [IDisposable]){$pic.Dispose()}}}#
      44. Delete all images in folder whose dimensions are / are not 800px by 600px
        1. Delete all images in folder whose dimensions are / are not 800px by 600px
          Add-Type -AssemblyName System.Drawing$imagesToDelete = Get-ChildItem . |Where-Object {try {$pic = [System.Drawing.Image]::FromFile($_.FullName)# We only want images that are / are not 800x600$pic.Width -eq 800$pic.Height -eq 600 # $pic.Width -ne 800# $pic.Height -ne 600 }catch{# Ignore errors (== probably not an image)}finally {# Clean upif($pic -is [IDisposable]){$pic.Dispose()}}}$imagesToDelete | Remove-Item 
      45. Parse html

        1. match all anchor tags with localhost. localhost only.
          1. $z = Invoke-WebRequest http://localhost/dfellows.rf.gd/htdocs/site_html/weather.html$z.Links$z.Links.Count$z.Links.outerhtml
        2. with match regex
          1. Output everything between the body tags. Do not include / include <body> tags in results. See working on a local / remote file below. See find anything between any <tag> and the very first instance of </tag> below.

            Greedy and lazy quantifiers explained

            regex101.com is your friend

        3. Copy and paste into PowerShell 5.1. It will output everything between <body></body>. The results outputs twice. Once without the body tags and once with.

          1. $testhtml = @'<!doctype html><html lang="en"><head><meta charset="utf-8"><title>AdminWeb</title><base href="/wwwroot/admin-web/"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="icon" type="image/x-icon" href="favicon.ico"></head><body><app-root></app-root><script src="/wwwroot/admin-web/runtime.js"></script><script src="/wwwroot/admin-web/file1.js" nomodule></script><script src="/wwwroot/admin-web/file2.js"></script><script src="/wwwroot/admin-web/styles.js"></script><script src="/wwwroot/admin-web/vendor.js"></script><script src="/wwwroot/admin-web/main.js"></script></body></html>'@				    $testhtml -match '(?s)(?<=<body>).+?(?=<\/body>)';$matches[0] $testhtml -match '(?s)(<body>).+?(<\/body>)';$matches[0] 
          2. The command can also be written:
            [regex]::matches($testhtml,'(?s)(?<=<body>).+?(?=<\/body>)').Value  [regex]::matches($testhtml,'(?s)(<body>).+?(<\/body>)').Value
          3. Three different commands to work on a local file. Output does not include body tags:
            1. (gc -Raw test.html) -match '(?s)(?<=<body>).+?(?=<\/body>)';$matches[0]     					  [Regex]::Matches((gc -Raw test.html), '(?s)(?<=<body>).+?(?=<\/body>)').Value    					  gc test.html -Raw | Select-String '(?s)(?<=<body>).+?(?=<\/body>)' -AllMatches | % { $_.Matches } | % { $_.Value }

               

          4. Output to results.html:
            1. gc test.html -Raw | Select-String '(?s)(?<=<body>).+?(?=<\/body>)' -AllMatches | % { $_.Matches } | % { $_.Value } | sc results.html 

               

          5. Remote url without and with body tag:
            1. $testhtml = Invoke-WebRequest -Uri http://www.pgatour.com  
              $testhtml -match '(?s)(?<=<body>).+?(?=<\/body>)'
              $matches[0]
              $testhtml -match '(?s)(<body>).+?(<\/body>)'
              $matches[0]
          6. Remote url without and with body tag. Output to results.html:
            1. $testhtml = Invoke-WebRequest -Uri http://www.pgatour.com  
              $testhtml -match '(?s)(?<=<body>).+?(?=<\/body>)'
              $matches[0] | sc results.html


              $testhtml -match '(?s)(<body>).+?(<\/body>)'
              $matches[0] | sc results.html

               

          7. Remote url between any tag and the first instance of /tag
            1. Never use (.+?|\n)*, always use (?s).+? – @Wik stackoverflow
            2. See stackoverflow
            3. $testhtml = Invoke-WebRequest -Uri http://www.pgatour.com  
              $testhtml -match '(<div class="success-message">)(?s).+?(<\/div>)'
              $matches[0]


              Invoke-WebRequest -Uri http://www.pgatour.com | sc results.html
              (gc -raw results.html) -match '(<div class="success-message">)(?s).+?(<\/div>)'
              $matches[0]
          8. Remote url by classname. These work but are not very productive. See Parsing HTML Webpages with Powershell.
            1. $response = Invoke-WebRequest -Uri http://www.pgatour.com  
              $response.ParsedHtml.body.getElementsByClassName('success-message')
              $( $response.ParsedHtml.getElementsByTagName('div') | ?{$_.className -eq 'success-message'} ).outerHTML
              $( $response.ParsedHtml.body.getElementsByTagName('div') | Where {$_.getAttributeNode('class').
      46. How to get a YouTube playlistId using Windows 10, PowerShell 5.1 or 7.0, invoke-restmethod and a regular expression for use in youtube-dl? See %windows2%\_27.ps1
        1. Get YouTube channel NFL "Game Highlights (Week X)" playlistId:
          1. Game Highlights (Week 4) | NFL 2020
            is the most unique pattern in the source. Of 256k characters it only occurs once. The playlistId occurs after list= and before ","webpagetype
            "runs":[{"text":"Baldy Breakdowns | NFL","navigationEndpoint":{"clickTrackingParams":"CEAQljUYACITCLnRyYi8oewCFTDDFgkdFiYOzTIJYzQtdmlkZW9zWhhVQ0RWWVE0WmhibTNTMmRsejdQMUdCRGc=","commandMetadata":{"webCommandMetadata":{"url":"/watch?v=z5xm1yUnF_A\u0026list=PLRdw3IjKY2gkxzCrNTjJ64jnCc6ZLjkg4","webPageType":"WEB_PAGE_TYPE_WATCH","rootVe":3832}},}}]"runs":[{"text":"Game Highlights (Week 4) | NFL 2020","navigationEndpoint":{"clickTrackingParams":"CDUQljUYDyITCKnihZHZnuwCFdXhggodkEkDEzIJYzQtdmlkZW9zWhhVQ0RWWVE0WmhibTNTMmRsejdQMUdCRGc=","commandMetadata":{"webCommandMetadata":{"url":"/watch?v=qAZj4vQRleo\u0026

            list=

            PLRdw3IjKY2gmo2FVKs1NlGtfQX6FB_JkE

            ","webPageType

            ":"WEB_PAGE_TYPE_WATCH","rootVe":3832}},}}]
            https://www.bing.com/search?&q=nfl+2020+schedule

            # BEGIN Get the YouTube channel NFL "Game Highlights (Week X)" playlistId with $env:windows2\_27.ps1# Get the start date of the NFL season into a text file so you can use the text file to determine the week of the season next week.if(!(Test-Path $env:windows2\_27.ps1NFLstart.txt)) {$zyear=get-date -Format "yyyy"start "https://www.bing.com/search?&q=NFL+$zyear+schedule"$zstart=Read-Host -Prompt 'Go to the browser, get the start date of the NFL season, close the browser and enter the start date into this window (mm/dd/yy i.e. 09/10/20) 'if ($zstart) {$zstart|out-file $env:windows2\_27.ps1NFLstart.txtWrite-output "The start date of the NFL season in mm/dd/yy format. See _27.ps1" | add-content $env:windows2\_27.ps1NFLstart.txt} else {Write-Host "You must enter the start date.  Script will exit in 60 seconds."start-sleep 60exit }}$zyear=get-date -Format "yyyy"$zstart=gc $env:windows2\_27.ps1NFLstart.txt -first 1 ; # load start date into memory$zweek=New-TimeSpan -Start $zstart -End (get-date -format MM/dd/yy) ; # how many days have passed since the season began?# $zweek.days / 7 ; # Display how many weeks have passed since the season began.if(($zweek.days / 7) -match '\.'){$zweek=[math]::ceiling($zweek.days / 7)}else{$zweek=($zweek.days / 7 + 1)} ; # If $zweek has a decimal round $zweek up even if the fraction is < .5    If it is an integer add one to it.$zweek=[int]$zweek ; # The week of the season as an integer.# $zweek ; # Display the week of the season.if ($z0 -eq "Fri" -or $z0 -eq "Mon" -or $z0 -eq "Tue"){$z=Invoke-restmethod https://www.youtube.com/c/NFL/playlists; # If it is Fri or Mon or Tue load the youtube page containing the playlistId into memory.$z=$z -replace "[^a-zA-Z0-9_-]" ; # Strip out all non-word characters except underscore and hyphen$z -match "(?s)GameHighlightsWeek$zweekNFL$zyear.+?list(.+?)webPageType" | out-null ; # Match the playlistId with a regular expression. The Id is captured by (.+?). See Explanation of the regular expression by Regex Buddy below.$zid=$matches[1]; # The playlistIdWrite-host "$zid is the playlistId of the playlist `"Game Highlights Week ($zweek) NFL | $zyear`""; # Display the playlistId#pushd "$env:userprofile\downloads\_1nfl" # Change to directory $env:userprofile\downloads\_1nfl$host.ui.rawui.WindowTitle = "This is _27.ps1. First $z0 $zid" #powershell window title for first pass# youtube-dl --download-archive $env:temp2\archive.txt --playlist-items 1-16 $zidyoutube-dl --download-archive $env:temp2\archive.txt "$zid" # Download all the videos in the playlist (~15)$host.ui.rawui.WindowTitle = "This is _27.ps1. Second $z0 $zid" #powershell window title for second passwhile (test-path *.part){# youtube-dl --download-archive $env:temp2\archive.txt --playlist-items 1-16 $zidyoutube-dl --download-archive $env:temp2\archive.txt "$zid" # While loop to restart download at point where download failed until download successful.popd # Return to directory before pushd}}##    END Get the YouTube channel NFL "Game Highlights (Week X)" playlistId

            Work local:

            $html = @'<!doctype html><html  style="font-size: 10px;font-family: Roboto, Arial, sans-serif;" lang="en-US" dir="ltr" gl="US"><head>{"runs":[{"text":"Can't-Miss Plays (Week 4) | NFL 2020","navigationEndpoint":{"clickTrackingParams":"CEQQljUYACITCKnihZHZnuwCFdXhggodkEkDEzIJYzQtdmlkZW9zWhhVQ0RWWVE0WmhibTNTMmRsejdQMUdCRGc=","commandMetadata":{"webCommandMetadata":{"url":"/watch?v=359dcOIvOZ0\u0026list=PLRdw3IjKY2gn8JlCazlMFvhxDp0QIbrFY","webPageType":"WEB_PAGE_TYPE_WATCH","rootVe":3832}},"watchEndpoint":{"videoId":"359dcOIvOZ0","playlistId":"PLRdw3IjKY2gn8JlCazlMFvhxDp0QIbrFY","params":"OAI%3D"}}}]}{"runs":[{"text":"Game Highlights (Week 4) | NFL 2020","navigationEndpoint":{"clickTrackingParams":"CDUQljUYDyITCKnihZHZnuwCFdXhggodkEkDEzIJYzQtdmlkZW9zWhhVQ0RWWVE0WmhibTNTMmRsejdQMUdCRGc=","commandMetadata":{"webCommandMetadata":{"url":"/watch?v=qAZj4vQRleo\u0026list=PLRdw3IjKY2gmo2FVKs1NlGtfQX6FB_JkE","webPageType":"WEB_PAGE_TYPE_WATCH","rootVe":3832}},"watchEndpoint":{"videoId":"qAZj4vQRleo","playlistId":"PLRdw3IjKY2gmo2FVKs1NlGtfQX6FB_JkE","params":"OAI%3D"}}}]}</body></html>'@$zyear=get-date -Format "yyyy"$zstart=gc $env:windows2\_27.ps1NFLstart.txt -first 1 ; # load start date into memory$zweek=New-TimeSpan -Start $zstart -End (get-date -format MM/dd/yy) ; # how many days have passed since the season began?# $zweek.days / 7 ; # Display how many weeks have passed since the season began.if(($zweek.days / 7) -match '\.'){$zweek=[math]::ceiling($zweek.days / 7)}else{$zweek=($zweek.days / 7 + 1)} ; # If $zweek has a decimal round $zweek up even if the fraction is < .5    If it is an integer add one to it.$zweek=[int]$zweek ; # The week of the season as an integer.# $zweek ; # Display the week of the season.if ($z0 -eq "Fri" -or $z0 -eq "Mon" -or $z0 -eq "Tue"){$z=Invoke-restmethod https://www.youtube.com/c/NFL/playlists; # If it is Fri or Mon or Tue load remote NFL source file into memory.$z=$z -replace "[^a-zA-Z0-9_-]" ; # Strip out all non-word characters except underscore and hyphen$z -match "(?s)GameHighlightsWeek$zweekNFL$zyear.+?list(.+?)webPageType" | out-null ; # Match the playlistId with a regular expression. The Id is captured by (.+?)$zid=$matches[1]; # The playlistIdWrite-host "$zid is the playlistId of the playlist `"Game Highlights Week ($zweek) NFL | $zyear`""; # Display the playlistId#

            Explainaton of regex:

            PlaylistRendererplaylistId((?:(?!PlaylistRendererplaylistId).)*?)((?:(?!.thumbnailthumbnail.*runstext).)*?)SNL  Season 47 Episode 5

             

            Options: case insensitive

            Created with RegexBuddy

      47. Creationtime: write a new creationtime
        1. Creationtime: write a new creationtime

          Powershell default file sort is oldest files first:

          gci -file | Sort-Object creationtime | select name,creationtime

          Sort by newest file

          gci -file | sort -desc creationtime | select name,creationtime

          Write new creationtime. Each file is one minute newer. Force causes gci to include hidden files.

          $z=get-date$arr = @(gci -force | Sort-Object creationtime)$arr | ForEach {$_.CreationTime  = $z$z = $z.addMinutes(-1)}
      48. RENAME FILES
        1. Replace string:
          (gci *searchyoutube*.lnk) | Rename-Item -NewName {$_.name -replace "SearchYouTube","DownLoadYoutube"}
        2. Trim file basename: Split on the comma. [0]=everything before the comma [1]=everything after the comma.
          gci $env:userprofile\pictures -Filter *.jpg -File | Rename-Item -NewName { $_.BaseName.Split(',')[0] + $_.Extension } -WhatIf
        3. Add incremental prefix to basename (i.e. a10alice.mp3, a11bbc4.mp3, ...). Count files to determine padding.
          $z=gci * | Measure-Object | %{$_.Count}if ($z -gt 9){$i = [ref]10}if ($z -gt 99){$i = [ref]100}if ($z -gt 999){$i = [ref]1000}gci *.mp3 | Sort lastwritetime | rename-item -NewName {'a{0}{1}' -f $i.value++, $_.Name} -whatif
        4. Replace / Remove character / characters in file name
          $delim = "."gci * -Name | `foreach { $nameArray = $_.Split($delim)$newname = $nameArray[1]+"."+$nameArray[2] -replace " ", ""$newName = $newName -replace ",", ""$newName = $newName -replace ";", ""$newName = $newName -replace "\(",""$newName = $newName -replace "\)",""Write-Output $newNamerename-item $_ $newName -whatif} 
      49. windir\_11.ps1
        1. create html pages by parsing my questions or answers at stackoverflow. extract html. build html.
        2. choice menu
        3. line number
      50. windir\_10.ps1
        1. line number
        2. find and replace text in windir\_61.bat
        3. this is run by scheduled task "2dailybackup"
        4. it renumbers the strings "AROUND LINE {1-9999}" and "LINE2 {1-9999}" and replace {1-9999} with the {line number} the code is on
      51. windir\_9.ps1
        1. _61.html
        2. redact text files
      52. windir\_7.ps1
        1. DELETE MIDDLE AGE FOLDER
      53. windir\_2.ps1
        1. last 100
        2. recursively search a VOLUME for files, sort by last write time and display the newest 10, 50, OR 100 of them by descending date.
      54. delete long paths / filenames
        1. powershell Remove-Item2 "path\to\folder" -Recurse
          1. see windir\_date7.bat

  34. REGEX (Top)
    1. Match 0.0 surrounded by whitespace
      1. \s(0\.0)\s
    2. Match 0
      1. (?<!\d)0(?!\d)
    3. Match negative number
      1. -(?<!\d)
    4. Match everything between two strings
      1. (.+?)
    5. Case sensitive
      1. (?i)
    6. Sum and average a text file; Do not include lines that only contain 0: Get line w/ 160 but not line with 0.
      1. See flashdrive\downloads\104.psm1
        1. $z2=(get-content $env:userprofile\downloads\$zname`lasttime.txt) -notmatch '`(`?<!`\d`)0`(?!`\d`)' ; # gc of all lines that does not have only: 0 i.e. Get 160 but not 0.             $z=[math]::Ceiling(($z2 | measure -sum | % sum) / [int]$z2.count) ; write-output "`n   Average seconds needed: $z"
    7. See Parsing local \ remote html with PowerShell 5.1 match regex.
    8. See Parse textfile of file paths and extract basename from fullname with PowerShell 5.1 and a regex.
    9. Powershell 5
      1. Find youtube NFL channel current week Game Highlights playlistID with Windows 10, Powershell 5 , regular expression and download files in list with yt-dlp
        1. Find youtube NFL channel current week Game Highlights playlistID with Windows 10, Powershell 5, a regular expression and download files in list with yt-dlp
          1. 
                                  

            Explanation at regex101.com

            See "G:\MYAPPS\WINDOWS\_46.ps1" on laptop and thumb drive.

            See Expresso regex tester project file "C:\Users\_56\Documents\Expresso Projects\_playlistIdYouTube2022NFLGameHighlights.xso" on laptop

            Pattern:

            playlistId((?:(?!playlistId).)*?)(?:(?!.thumbnailthumbnail.*runstext).)*?2022NFLWeek9GameHighlights

            "playlistId((?:(?!playlistId).)*?)(?:(?!.thumbnailthumbnail.*runstext).)*?$zseason$zleague`Week$zweek`GameHighlights"

            Explanation:

            1. / playlistId((?:(?!playlistId).)*?)(?:(?!.thumbnailthumbnail.*runstext).)*?2022NFLWeek9GameHighlights /gmi
              1. playlistId matches the characters playlistId literally (case insensitive)
              2. 1st Capturing Group ((?:(?!playlistId).)*?)
                1. Non-capturing group (?:(?!playlistId).)*?
                  1. *? matches the previous token between zero and unlimited times, as few times as possible, expanding as needed (lazy)
                  2. Negative Lookahead (?!playlistId)
                    1. Assert that the Regex below does not match
                    2. playlistId matches the characters playlistId literally (case sensitive)
                  3. . matches any character (except for line terminators)
              3. Non-capturing group (?:(?!.thumbnailthumbnail.*runstext).)*?
                1. *? matches the previous token between zero and unlimited times, as few times as possible, expanding as needed (lazy)
                2. Negative Lookahead (?!.thumbnailthumbnail.*runstext)
                  1. Assert that the Regex below does not match
                  2. . matches any character (except for line terminators)
                  3. thumbnailthumbnail matches the characters thumbnailthumbnail literally (case sensitive)
                  4. . matches any character (except for line terminators)
                  5. * matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
                  6. runstext matches the characters runstext literally (case sensitive)
                3. . matches any character (except for line terminators)
              4. 2022NFLWeek9GameHighlights matches the characters 2022NFLWeek9GameHighlights literally (case sensitive)
              5. Global pattern flags
                1. g modifier: global. All matches (don't return after first match)
                2. m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
            Match  1 189-433 playlistIdPLRdw3IjKY2gnRq5yLjsg_3pcVSYPYU06ethumbnailthumbnailsurlhttpsiytimgcomviOxC2gP9_oX4hqdefau...
            Group  1 199-233 PLRdw3IjKY2gnRq5yLjsg_3pcVSYPYU06e
      2. SNL youtube playlistID
        1. SNL youtube playlistID
          1. Windows 10. Powershell 5.Regular expression that works in both Powershell 5 and Notepad++ v8.1.4 (32-bit) Build time : Aug 21 2021 - 12:58:42A ~329K string (DOCTYPE html) is added to every few days.SNL  Season 47 Episode 5 only occurs once.PlaylistRendererplaylistId occurs many times.Regular expression in Powershell 5 to match PLS_gQd8UB-hJqEpQXXHi5axYnKJ0nrIsURegex:PlaylistRendererplaylistId((?:(?!PlaylistRendererplaylistId).)*?)((?:(?!.thumbnailthumbnail.*runstext).)*?)SNL  Season 47 Episode 5String:PlaylistRendererplaylistIdPLS_gQd8UB-hKj8u3SsdIFJQj7nGJxr_tQthumbnailthumbnailsurlhttpsiytimgcomviAIuWQ41m7yshqdefaultjpgsqp-oaymwEXCOADEI4CSFryq4qpAwkIARUAAIhCGAEu0026rsAOn4CLBR9e9TcJsxqvgT-fXtdGZJLNSgcgwidth480height270titlerunstextPleaseDontDestroyPlaylistRendererplaylistIdPLS_gQd8UB-hJqEpQXXHi5axYnKJ0nrIsUthumbnailthumbnailsurlhttpsiytimgcomviCU-WdnXJabshqdefaultjpgsqp-oaymwEXCOADEI4CSFryq4qpAwkIARUAAIhCGAEu0026rsAOn4CLDqZkaq-158Q0JCgIbgpPLgK2HA6gwidth480height270titlerunstextSNL  Season 47 Episode 5

            Matches, but is there a better way? A more logical way? For example this regex does not work in Notepad++

            Demo at regex101.com

            Explaination of regex

            Powershell 5:
               # ~16 videos ;  $z = Invoke-RestMethod https://www.youtube.com/snl/playlists ;  $z = $z -replace "[^a-zA-Z0-9 _-]" ; # Strip out all non-word characters except whitespace, underscore and hyphen   # $z2=get-date -f 'ddhhmmss' ; # Create a unique file basename  # $z|out-file "$z2.txt" ; # Save page to local file # $z=gc "$z2.txt" ; # Load local file   # BEGIN What Season (Year) of SNL?  $zyear='10/11/1975' ;   $zyear = New-TimeSpan -Start $zyear -End (Get-Date -Format MM/dd/yy) ; # What Season (Year) of SNL? ;   $zyear ;    $zyear.days / 365 ; if (($zyear.days / 365) -match '\.') { $zyear = [string][math]::Ceiling($zyear.days / 365) } ;  $zyear ;    #   END What Season (Year) of SNL?  # BEGIN What Episode (Week) of the Season (Year) of SNL?    $zweek='10/02/2021' ;   $zweek = New-TimeSpan -Start $zweek -End (Get-Date -Format MM/dd/yy) ; # What Episode (Week) of the Season? $zweek ;    $zweek.days / 7 ;   if (($zweek.days / 7) -match '\.') { $zweek = [string][math]::Floor($zweek.days / 7) }  ;   $zweek ;    #   END What Episode (Week) of the Season (Year) of SNL?    $z -match "PlaylistRendererplaylistId((?:(?!PlaylistRendererplaylistId).)*?)((?:(?!.thumbnailthumbnail.*runstext).)*?)SNL  Season $zyear Episode $zweek" | Out-Null ;   $zid = $matches[1] ; # The playlistId   $zid ;
    10. NOTEPAD++ NPP NOTEPAD PLUS
      1. SPECIAL CHARACTERS
        1. *, $, \, +, ^, ( ), [ ], { }
      2. Remove entries in regfiles
        1. Remove entries in regfiles
          1. "DirName1"="e:\\Program Files\\Jasc Software Inc\\Paint Shop Pro 7\\Shapes""DirName2"="e:\\Program Files\\Jasc Software Inc\\Paint Shop Pro 7\\Brushes""DirName3"="d:\\Program Files (x86)\\Jasc Software Inc\\Paint Shop Pro 7\\Tubes"Find what: "dirname[^1]"=".+?"
            Replace with: Options: case insensitiveMatch the characters “"dirname” literally «"dirname»Match any character that is NOT a “1” «[^1]»Match the characters “"="” literally «"="»Match any single character that is not a line break character «.+?»Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»Match the character “"” literally «"»Created with RegexBuddyBecomes:"DirName1"="e:\\Program Files\\Jasc Software Inc\\Paint Shop Pro 7\\Shapes"
      3. Replace tag w/ attributes w/ tag w/ no attributes
        1. Replace tag w/ attributes w/ tag w/ no attributes
          1. Find what: <div.+?>
            Replace with: <div>
      4. Everything after the body tag till <div class="container"> tag, in this case the nav tag. Created with RegexBuddy.
        Regular Expression:
        (?<=<body>)([\s\S]*)(?=<div class="container">)
        Explanation:
        Options: case insensitiveAssert that the regex below can be matched, with the match ending at this position (positive lookbehind) «(?<=<body>)»Match the characters “<body>” literally «<body>»Match the regular expression below and capture its match into backreference number 1 «([\s\S]*)»Match a single character present in the list below «[\s\S]*»Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»A whitespace character (spaces, tabs, line breaks, etc.) «\s»Any character that is NOT a whitespace character «\S»Assert that the regex below can be matched, starting at this position (positive lookahead) «(?=<div class="container">)»Match the characters “<div class="container">” literally «<div class="container">»
        Test string from "... \htdocs\imagemagick\script\index.html":
        <body> <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark"> <a class="navbar-brand" href="/"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="/script/../image/wand.ico"/></a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsMagick" aria-controls="navbarsMagick" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="navbar-collapse collapse" id="navbarsMagick" style=""> <ul class="navbar-nav mr-auto"> <li class="nav-item"> <a class="nav-link" href="/script/../">Home <span class="sr-only">(current)</span></a> </li> <li class="nav-item"> <a class="nav-link" href="/script/../script/download.php">Download</a> </li> <li class="nav-item"> <a class="nav-link" href="/script/../script/command-line-tools.php">Tools</a> </li> <li class="nav-item"> <a class="nav-link" href="/script/../script/command-line-processing.php">Command-line</a> </li> <li class="nav-item"> <a class="nav-link" href="/script/../script/resources.php">Resources</a> </li> <li class="nav-item"> <a class="nav-link" href="/script/../script/develop.php">Develop</a> </li> <li class="nav-item"> <a class="nav-link" target="_blank" href="https://github.com/ImageMagick/ImageMagick/discussions">Community</a> </li> </ul> </div> <form class="form-inline my-2 my-lg-0" action="/script/../script/search.php"> <input class="form-control mr-sm-2" type="text" name="q" placeholder="Search" aria-label="Search"> <button class="btn btn-outline-success my-2 my-sm-0" type="submit" name="sa">Search</button> </form> </nav> <div class="container">
      5. REPLACE TEXT WITH "SEARCH MODE EXTENDED" NPP. REPLACE TEXT WITH "SEARCH MODE EXTENDED
      6. delete comments in css
        1. \s*(?!<\")\/\*[^\*]+\*\/(?!\")\s*
        2. /* End Browser Reset */
      7. REPLACE 7000 in "DO IT AGAIN" MACRO .DIA FILE
        Pause 7000 [6]
        1. se.+?\[
      8. add whitespace to every line that does not begin with whitespace. Formats text for use on superuser.com, turning text into "code".
        1. ^(?=\S)
      9. strip out data from nirsoft.com browsing history view. Mostly edit the url.
        1. <a href="
        2. (">[^>]*[^>]*</a>)
        3. (\?[^>]*[^>]*>)
    11. search and replace (sr32.exe)
      1. replace text between two html tagssearch and replace screenshot. replace text between html tags
    12. regex101.com
      1. replace all between two html map tags
        1. <map name="Map">(.+?)<\/map>
    13. regex buddy
      1. pcre html anchor tag. works on all html
        1. match <a to /a>
          1. <a[^>]*>([^<]+)<\/a>
        2. copy and paste all matches

  35. FFMPEG(Top)
    1. ffmpeg chokes on Powershell yyyy/m/dd ;chokes on forward slash. Use yyyy-m-dd for ffmpeg.
    2. Merge .mp4 and .m4a with Windows 10 64-bit and ffmpeg.
      https://superuser.com/questions/277642/how-to-merge-audio-and-video-file-in-ffmpegffmpeg -i 1.mp4 -i 1.m4a -c:v copy -c:a aac 2.mp4
    3. Concatenate .mp4 with Windows 10 64-bit, powershell 5 and ffmpeg using intermediate .ts file. Without comments.
      # Concatenate .mp4 with Windows 10 64-bit, powershell 5 and ffmpeg using intermediate .ts file# get sample .mp4 https://www.vjloops.com/stock-video/circle-flow-offsets-01-138855.html# BEGIN PREP$ErrorActionPreference="SilentlyContinue" ; $z=Get-Date -f 'MMddyy-hhmmss';ni -ItemType Directory $z > $null ;# make 3 copies of 1.mp4 1..3 | foreach { copy-item 1.mp4 "$z\$_.mp4" > $null}remove-item "$z\list3.txt" #   END PREP# BEGIN CONCATENATE foreach ($i in gci "$z\*.mp4" | % basename) {ffmpeg -y -i "$z\$i.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts "$z\$i.ts"}foreach ($i in gci "$z\*.mp4" | % name) {echo "file '$z\$i'" | out-file "$z\list3.txt" -append -Force -Encoding ASCII}&ffmpeg -y -f concat -safe 0 -i "$z\list3.txt" -crf 23 "$env:userprofile\desktop\NotifyAnimation.mp4" # Change quality from default of 23 to ?. 51= worst. 0 = best.#   END CONCATENATE#CLEAN UPremove-item "$z" -Recurse -confirm
    4. Concatenate .mp4 with Windows 10 64-bit, powershell 5 and ffmpeg using intermediate .ts file. With comments.
      # Concatenate .mp4 with Windows 10 64-bit, powershell 5 and ffmpeg using intermediate .ts file# get sample .mp4 https://www.vjloops.com/stock-video/circle-flow-offsets-01-138855.html# BEGIN PREP$ErrorActionPreference="SilentlyContinue" ; # $ErrorActionPreference = "Continue" ;$z=Get-Date -f 'MMddyy-hhmmss';ni -ItemType Directory "$z" > $null ;# make copies of .mp4 1..3 | foreach { copy-item 1.mp4 "$z\$_.mp4" > $null}#   END PREP# BEGIN CONCATENATE # copy .mp4 to .tsforeach ($i in gci "$z\*.mp4" | % basename) {ffmpeg -y -i "$z\$i.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts "$z\$i.ts"}# http://trac.ffmpeg.org/wiki/Concatenate# Create ASCII list of files for ffmpeg -i input in format "file 'directory\name' = file '081721-015117\3.ts'remove-item "$z\list3.txt" # next line out-file must use -append AND must use -Encoding ASCIIforeach ($i in gci "$z\*.mp4" | % name) {echo "file '$z\$i'" | out-file "$z\list3.txt" -append -Force -Encoding ASCII}# http://trac.ffmpeg.org/wiki/Concatenate&ffmpeg -y -f concat -safe 0 -i "$z\list3.txt" "$env:userprofile\desktop\NotifyAnimation.mp4"# reduce quality from default of 23 to 30. 51= worst 0 = best.#&ffmpeg -y -f concat -safe 0 -i "$z\list3.txt" -crf 30 "$env:userprofile\desktop\NotifyAnimation.mp4"#&ffmpeg -y -f concat -safe 0 -i "$z\list3.txt" -crf 40 "$env:userprofile\desktop\NotifyAnimation.mp4"#   END CONCATENATE#CLEAN UPri "$z" -Recurse -confirm
    5. Concatenate .mp4 with Windows 10 64-bit, cmd and ffmpeg using intermediate .ts file
      rem Concatenate .mp4 with Windows 10 64-bit, cmd and ffmpeg using intermediate .ts filerem get sample .mp4 https://www.vjloops.com/stock-video/circle-flow-offsets-01-138855.htmlrem BEGIN PREPrem make directory mmddyy-hhmmss i.e. 081721-085851FOR /f "TOKENS=1-4" %%g in ('time/T') do set zhhmmss=%%g%%i%TIME:~10,2%FOR /f "TOKENS=1-4" %g in ('time/T') do set zhhmmss=%g%i%TIME:~10,2%set zfolder=%DATE:~-10,2%%DATE:~-7,2%%DATE:~-2,2%-%zhhmmss%md "%zfolder%"for /l %g in (2,1,4) do copy /y "1.mp4" "%zfolder%\%g.mp4"for /l %%g in (2,1,4) do copy /y "1.mp4" "%zfolder%\%%g.mp4"rem   END PREPrem BEGIN CONCATENATE for %g in (%zfolder%\*.mp4) do (echo ffmpeg -y -i "%g" -c copy -bsf:v h264_mp4toannexb "%zfolder%\%~ng.ts")for %g in ("%zfolder%\*.ts") do (echo file '%g')>>list.txtrem -crf quality 23 = default, 51 = worst, 0 = best ffmpeg -f concat -safe 0 -i "list.txt" -crf 40 output.mp4rem copy .mp4 to .tsfor %%g in (%zfolder%\*.mp4) do (ffmpeg -y -i "%%g" -c copy -bsf:v h264_mp4toannexb "%zfolder%\%%~ng.ts")rem Make ASCII list of filesfor %%g in ("%zfolder%\*.ts") do (echo file '%%g')>>list.txtffmpeg -f concat -safe 0 -i "list.txt" -c copy output.mp4rem -crf quality 23 = default, 51 = worst, 0 = best  ffmpeg -f concat -safe 0 -i "list.txt" -crf 40 output.mp4pause rem   END CONCATENATErem CLEAN UPrd /q /s %zfolder%
    6. Add title to video with drawtext. font size, color, border and center.
      1. stackoverflow
        ffmpeg -ss 00:02:00 -i 1.mkv -vf "[in]drawtext=fontsize=48:fontcolor=white:bordercolor=black:borderw=2:text='To the Well for the Water':x=10:y=(h)/4:enable='between(t,0,10)', drawtext=fontsize=48:fontcolor=white:bordercolor=black:borderw=2:text='June 21st, 2021': x=(w-text_w)/2:y=((h)/4)+60:enable='between(t,0,10)', drawtext=fontsize=48:fontcolor=white:bordercolor=black:borderw=2:text='St. Pauls Episcopal Church':x=10:y=((h)/4)+120:enable='between(t,0,10)', drawtext=fontsize=48:fontcolor=white:bordercolor=black:borderw=2:text='Concord, New Hampshire':x=(w-text_w)/2:y=((h)/4)+180:enable='between(t,0,10)'[out]" -y -t 00:00:30 output.mkv 
    7. Add title to video with .jpg slide. Display it for 10 seconds from 0 to 10 seconds.
      1. No link yet.
        ffmpeg -ss 00:02:00 -y -i 1.mkv -i 1.jpg -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,10)'" -codec:a copy -t 00:00:30 output.mkv
        ffmpeg -ss 00:02:00 -y -i 1.mkv -i 1.jpg -filter_complex "overlay=x=(w)/8:y=(h)/2:enable='between(t,0,10)'" -codec:a copy -t 00:00:30 output.mkv
        https://stackoverflow.com/a/52592245/8826818ffmpeg -y -i 1.mkv -i 1.jpg -filter_complex "[1]format=yuva444p,colorchannelmixer=aa=0.5[1.jpg];[1.jpg][0]scale2ref[1.jpg][1.mkv];[1.mkv][1.jpg]overlay" -t 00:00:30 output.mkv
    8. Record with Haupaugge HVR-1600 and WinTV7 and process with Womble and ffmpeg.
      1. Record with Haupaugge HVR-1600 using i3 @3.4GHz, 8GB and WinTV7 = .ts file. WinTV7 Auto convert to .mpg. Cut commercials with Womble. Export to .mp4. Compress with ffmpeg. Womble finds the commercials in 1.5gb .ts file in under 5 minutes. Export takes ~8 minutes. ffmpeg: 24 minutes to output two hour (~1.5GB) .mp4 produces a good file. Using -async 10 solves audio losing sync when fast forwarding.
                 rem ffprobe -i 3.mpgDuration: 00:09:52.86 Bitrate: 5.338 Mbps Stream #0:0Video: mpeg2video, yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 59.94 fps, 59.94 tbr, 90k tbn, rem 119.88 tbc Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 224 kb/s Stream #0:2(eng): Audio: ac3, 48000 Hz, stereo, fltp, 128 kb/sffmpeg -ss 00:03:35 -y -i "State of Happiness S01E01 - Treasure Hunt 1080P x264 RB58.mp4" -b:v 1125k -filter:v scale=720:480 -ar 48000 -b:a 384k -t 00:01:30 "State of Happiness S01E01 - Treasure Hunt 720P x264 RB58.mp4"rem Recording made by WinTV = 2.6GB / hour = .TS extension. Auto convert to .mpg = 2.26GB / hour.rem Cut commercials with Womble. 377MB / 9 minutes takes ~4 minutes to bookmark and ~ 8 minutes to export to .mp4.rem Compress with ffmpeg. crf lower (0-50. 23 = default) + preset slower (medium = default) = better rem 27 + slow = 00:02:54  for 77MB / 5 MINUTES. 51% smaller = 38MB = 456MB / hour. Quality good enough for 1360x768 720dpi 20"TVffmpeg -y -i "3.mpg.womble.mp4" -crf 27.0 -vcodec libx264 -filter:v scale=1280:720 -preset slow -acodec aac -ar 48000 -b:a 128k -coder 1 -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 "3.mpg.womble.mp4.27slow.mp4"rem 25 + veryslow = 00:05:38  for 77MB / 5 MINUTES. 36% smaller = 50MB = 600MB / hour. Quality good enough.ffmpeg -y -i "3.mpg.womble.mp4" -crf 25.0 -vcodec libx264 -filter:v scale=1280:720 -preset veryslow -acodec aac -ar 48000 -b:a 128k -coder 1 -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 "3.mpg.womble.mp4.25veryslow.mp4"rem 23 + veryfast = 00:07:52 for 438MB. 68% smaller = 114MB. Quality not quite good enough.ffmpeg -y -i "2.ts" -crf 23.0 -vcodec libx264 -filter:v scale=1280:720 -preset veryfast -acodec aac -ar 48000 -b:a 128k -coder 1 -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 "2.ts.23veryfast.mp4"rem 20 + veryfast = 00:26:08 for 438MB. 53% smaller = 211MB. Quality good enough.ffmpeg -y -i "2.ts" -crf 20.0 -vcodec libx264 -filter:v scale=1280:720 -preset veryfast -acodec aac -ar 48000 -b:a 128k -coder 1 -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 "2.ts.20veryfast.mp4"rem 20 + veryslow = 00:23:34 for 438MB. 46% smaller = 238MB. Quality good enough.ffmpeg -y -i "2.ts" -crf 20.0 -vcodec libx264 -filter:v scale=1280:720 -preset veryslow -acodec aac -ar 48000 -b:a 128k -coder 1 -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 "2.ts.20veryslow.mp4"rem 25 + veryslow = 00:15:45 for 438MB. 72% smaller = 124MB. Quality good enough.ffmpeg -y -i "2.ts" -crf 25.0 -vcodec libx264 -filter:v scale=1280:720 -preset veryslow -acodec aac -ar 48000 -b:a 128k -coder 1 -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 "2.ts.25veryslow.mp4"rem 25 + veryslow = 00:28:13 for 77MB. 39% smaller = 47MB. Quality good enough.         ffmpeg -y -i "3.mpg.womble.mp4" -crf 25.0 -vcodec libx264 -filter:v scale=1280:720 -preset veryslow -acodec copy "3.mpg.womble.25veryslow.audiocopy.mp4"rem recording made by BeyondTV. 3GB / hour. TP extension.rem make a 00:01:30 second sample starting at 00:03:35FOR /f "delims=" %g IN ('DIR /b /a-d /od /tw *.tp') DO ffmpeg -ss 00:03:35 -y -i "%g" -b:v 1125k -filter:v scale=720:480 -ar 48000 -b:a 384k -t 00:01:30 "%~ng.mp4"rem do the whole fileFOR /f "delims=" %g IN ('DIR /b /a-d /od /tw *.tp') DO ffmpeg -y -i "%g" -b:v 1125k -filter:v scale=720:480 -ar 48000 -b:a 384k "%~ng.mp4"ffprobe -i golf.mp4 rem delay audio 3 secondsffmpeg -y -i golf.mp4 -itsoffset 3 -i golf.mp4 -codec copy -map 0:0 -map 0:1 golf2.mp4rem delay video 3 seconds at 00:09:36ffmpeg -y -itsoffset 3 -i golf.mp4 -i golf.mp4 -codec copy -map 0:0 -map 0:1 golf2.mp4ffmpeg -y -i golf.mp4 -itsoffset 3 -i golf.mp4 -c:a copy -c:v copy -map 0:1 -map 0:0 golf2.mp4rem https://superuser.com/a/1557090/1003800ffmpeg -y -i "manual.mpg" -crf 20.0 -vcodec libx264 -filter:v scale=1280:720 -preset slow -acodec aac -ar 48000 -b:a 128k -coder 1 -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 "%userprofile%\Desktop\manual.mpg.mp4"
    9. DELAY VIDEO 3 SECONDS TO SYNC AUDIO / VIDEO
      1. DELAY VIDEO 3 SECONDS. SYNC AUDIO / VIDEO
                 rem recording made by BeyondTVrem make a 00:01:30 second sample starting at 00:03:35FOR /f "delims=" %g IN ('DIR /b /a-d /od /tw *.tp') DO "C:\Windows\ffmpeg.exe" -ss 00:03:35 -y -i "%g" -b:v 1125k -filter:v scale=720:480 -ar 48000 -b:a 384k -t 00:01:30 "%~ng.mp4"rem do the whole fileFOR /f "delims=" %g IN ('DIR /b /a-d /od /tw *.tp') DO "C:\Windows\ffmpeg.exe" -y -i "%g" -b:v 1125k -filter:v scale=720:480 -ar 48000 -b:a 384k "%~ng.mp4"rem delay video 3 secondsffmpeg -y -itsoffset 3 -i golf.mp4 -i golf.mp4 -codec copy -map 0:0 -map 0:1 golf2.mp4rem Recording made by WinTV. 1GB / hour. TS extension.rem Cut commerials with Womble 
      2. VLC calls delaying the video "hastening the audio." Hastening the audio has a negative number. Hasten the audio 3 seconds with -3.0
    10. METADATA: See powershell metadata.
    11. METADATA: Replace -metadata title with file basename using PowerShell 5 and ffmpeg..
      "$z=$env:windir\ffmpeg.exe.lnk -y -i"gci *.mp3 -Name | foreach { #ffmpeg -y -i $_ -metadata title="$_" -c copy 2$_rename-item $_ b-$_ -whatif} 
    12. xxx
      1. xxx 

  36. WINDOWS(Top)
    1. WINDOWS 10
      1. Windows Forms
        1. Replaced several times but still live and kicking: Windows Forms updated for .NET 6.0
          1. Replaced several times but still live and kicking: Windows Forms updated for .NET 6.0

            22 November 2021

            https://www.techregister.co.uk/replaced-several-times-but-still-live-and-kicking-windows-forms-updated-for-net-6-0/

            Microsoft’s oldest .NET desktop framework, Windows Forms, has been improved for .NET 6, though fullsupport for high resolution displays is “a challenging undertaking,” according to software engineer IgorVelikorossov.

            The first release of Windows Forms was in February 2002, when it was positioned as the successor to VisualBasic 6.0 (1998) as a rapid application development framework for Windows desktop applications. Therewas huge friction in that transition, but it was nevertheless popular and easy to use. Underneath WindowsForms lies the Win32 API and the GDI+ graphics API.

            In late 2006, Microsoft introduced Windows Vista and along with it a new .NET desktop framework calledWindows Presentation Foundation (WPF). Unlike Windows Forms, it used DirectX to render graphics,enabling richer designs with hardware accelerated performance.WPF was also designed to scale nicely irrespective of the display resolution and Windows display settings,thanks to use of layout managers for positioning user interface elements.

            Windows Forms in Visual Studio 2022

            Why is Microsoft still investing in Windows Forms, the oldest .NET desktop framework, when it has beenreplaced several times, first by WPF, then by Windows 8 with its Windows Runtime APIs, then by UWP(Universal Windows Platform), and most recently by WinUI 3 (also known as Project Reunion)? The answer is simply the popularity of the framework and the number of legacy business applications that use it. Third-party component vendors also gave good support to the platform.

            It seems that despite the technical superiority of WPF, many business developers find Windows Formseasier, perhaps because of its apparently simple form designer where a button or checkbox stays where it isplaced, at least until users with different display settings complain about overlapping text or chopped-offcharacters.

            Windows Forms is only for Windows and not much was done to it for some years, especially as it was for.NET Framework and most development effort was going into the open source .NET Core. That changedwhen .NET Core 3.0 was released, with support for both Windows Forms and WPF. At this point bothframeworks became open source, though this was a fork and Velikorossov’s post about what’s new inWindows Forms concerns the .NET 6.0 version, not the .NET Framework one.

            Migration of an existing application is not straightforward and may be impossible without major surgery.

            Some features of .NET Framework, include Application Domains, .NET Remoting, Windows WorkflowFoundation, and Windows Communication Foundation (WCF), with WCF being the most problematic.

            Remote communication using SOAP (an XML remoting standard) and WCF was widely used, often withASP.NET on the web server and a Windows Forms client.

            Despite these issues, Microsoft has added features including accessibility improvements – such as betterscreen narrator support and user interface automation – updated templates to support the new .NET 6.0global using directive, and new runtime designers. “In .NET Core 3.0 we started to modernize and rejuvenateWindows Forms,” said Velikorossov.

            The biggest challenge remains scaling and high DPI (dots per inch) displays. The original scaling method forWindows Forms was based on the default system font, on whose size all the autoscaling of a formdepended. It was not a good system. There were rounding errors, issues with user controls and with forminheritance, and “forms and their child controls could only be concurrently designed by multiple developers iftheir machine resolutions were the same,” say the docs.

            There were tweaks, but high DPI support did not arrive until .NET Framework 4.7 and only worked onWindows 10 Creators Update and later. When the .NET Core version came along, Velikorossov describeshow the team changed the default font and “quickly learned that a great number of things depended on thisdefault font metrics.”

            The aim of full support for per-monitor V2 DPI awareness remains, meaning that applications are never bitmap scaled by Windows (causing fuzzy fonts) but are notified when DPI changes, maybe because of a setting change or a window being dragged to another display. “It is a challenging undertaking, and sadly we couldn’t achieve as much as we’d hoped,” said Velikorossov, but there are improvements with correct scaling of container controls and MDI child windows “in most scenarios.”

            There are also community contributions to Windows Forms for .NET 6.0 including MessageBox, used for quick dialogs requiring user confirmation or input, optionally getting two new buttons: Try Again, and Continue.

            Developers reacted to Velikorossov’s post with some requests. “Please add native dark mode,” was one, though apparently a challenge here is that “Windows still does not have a documented way to check whether the system is in light or dark mode.” Another commented gratefully that the “Form Designer in release VS 2022 works much better, it was way too slow.”

            When the .NET Foundation conducted a developer survey earlier this year, WPF and Windows Forms came out as more widely used than Microsoft’s more recent efforts.

            It is not a good choice for a GUI application today being Windows-only and a weak option even on Windows yet legacy combined with its initial ease of use means it will be around for many years to come something developers are less sure about with some other .NET technologies. ®

      2. Quick Access / Pinned List / Jump List
        1. Google search - windows RIGHT CLICK taskbar pinned EXPLORER
          Windows Registry Editor Version 5.00;RIGHT CLICK taskbar pinned EXPLORER; INCREASE NUMBER OF QUICK ACCESS TOOLBAR BUTTONS.[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced]"JumpListItems_Maximum"=dword:00000025"Start_JumpListItems"=dword:0000001e;http://superuser.com/questions/1035179/how-do-i-increase-the-number-of-items-on-a-jump-list-in-windows-10;https://www.tenforums.com/general-support/7983-increase-number-items-jump-lists.html 
      3. explorer
        1. Speedup explorer: disable windows search
          1. disable windows search with msconfig
        2. Copy / paste file created timestamp from Windows explorer gui failure:
          1. Paste into powershell 5.1 and remove invisibile character/s which show up as question mark/s.
            Sunday, ?August ?29, ?2021, ??9 : 12 : 11 AM
          2. When copy / paste into powershell_ise and run the error message is:
            1. Cannot convert value "Sunday, ‎August ‎29, ‎2021, ‏‎9 : 12 : 11 AM" to type "System.DateTime". Error: "String was not recognized as a valid DateTime."
              get-date "Sunday, ‎August ‎29, ‎2021, ‏‎9 : 12 : 11 AM"Cannot convert value "Sunday, ‎August ‎29, ‎2021, ‏‎9 : 12 : 11 AM" to type "System.DateTime". Error: "String was not recognized as a valid DateTime."
          3. When copy / paste into Notepad++ and run as a Powershell script the error message is:
            1. Cannot convert value "Sunday, ‎August ‎29, ‎2021, ‏‎9 : 12 : 11 AM" to type "System.DateTime". Error: "The string was not recognized as a valid DateTime."
              get-date "Sunday, ‎August ‎29, ‎2021, ‏‎9 : 12 : 11 AM"Cannot convert value "Sunday, ‎August ‎29, ‎2021, ‏‎9 : 12 : 11 AM" to type "System.DateTime". Error: "The string was not recognized as a valid DateTime."         
          4. When copy / paste into notepad++ and view all characters is selected the invisibile characters do not show up.
          5. Copy and paste explorer file created timestamp
          6. copy paste file explorer timestamp
          7. copy paste explorer file timestamp
          8. copy paste file timestamp
      4. Screenshot of my start menu
        StartMenuSCREENSHOT WILL BE HERE TOMORROW
      5. Change Wireless Mode readme18_files/0041.jpg original wireless mode. screenshot of device manager wireless network adapterreadme18_files/0042.jpg current wireless mode. screenshot of device manager wireless network adapter
      6. All troubleshooters shortcut
        1. %windir%\system32\control.exe /name microsoft.troubleshooting
      7. troubleshooter - network adapter
        1. %systemroot%\system32\msdt.exe -id NetworkDiagnosticsNetworkAdapter 

  37. ANDROID(Top)
    1. MicroSD: Which card to get.
      1. MicroSD: Which card to get.
        Get a card at least as fast as the internal memory. The SD class speed logos, in order from slowest (class 2) to fastest (UHS class 3). If you see no speed class symbol, you have a class 0 SD card. These cards were designed and produced before the speed class rating system was introduced. They may be slower than even a class 2 card.  Format it for internal or portable storage. The newest, fastest "app class" microSD cards are still not very good for apps.
        SD class speed logos, in order from slowest (class 2) to fastest (UHS class 3). See 0036.jpg
    2. v.9 PIE
      1. Dial in:
        Sandisk 32GB U1 MicroSD formatted for internal storage.About phone Software version Tap seven times Back to SettingsSystem AdvancedDeveloper options USB debugging - enable Default USB configuration - USB - File Transfer.
        Sandisk 32GB U1 MicroSD. See 0037.jpg
    3. v.4.4.4 KITKAT
      1. Dial in:
        Class 4 MicroSD card.About phone SW Version Tap seven times Back to SettingsDeveloper options USB debugging - enable

  38. godaddy (Top)
    1. 030920: BE CAREFUL USING CPANEL / VPANEL APPS (I.E. CRON JOBS, DIRECTORY PRIVACY, REDIRECTS, ERROR PAGES, ...). THEY OVERWRITE YOUR CUSTOM CODE.
      1. i don't know if linux economy with cpanel does this but why take a chance.
      2. linux economy without cpanel
        1. URL REDIRECTS
          1. BACKUP YOUR CUSTOM .HTACCESS FILE BEFORe USING "URL REDIRECTS". IT OVERWRITES.
        2. CRON JOB MANAGER
          1. BACKUP YOUR CUSTOM CRONTAB FILE BEFORE USING "CRON JOB MANAGER". IT OVERWRITES.
    2. Software i am using at godaddy
      1. Software i am using at godaddy1
      2. Software i am using at godaddy2 - Password protected
      3. linux economy with cpanel
        1. CloudLinux OS / CentOS 6?
        2. apache 2.4.33
        3. php 5.6.36
        4. bash 4.1.2(2)-release
        5. cPanel 70.0 (build 51)
        6. Perl 5.10.1
        7. cat /proc/version =
          1. Linux version 2.6.32-896.16.1.lve1.4.54.el6.x86_64 (mockbuild@buildfarm03.cloudlinux.com)
            (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) ) #1 SMP Wed May 2 07:43:19 EDT 2018
        8. screenshot of Godaddy cPanel Shared Hosting version numbers
    3. Software I was USING at GODADDY
      1. linux economy w/o cpanel
        1. CentOS release 5.5 (Final) - linux os
          1. CentOS release 5.5 (Final)
          2. find your version of linux
            1. Find your linux version. https://www.godaddy.com/help/unsupported-linux-distributions-shellshock-16634
        2. SCREENSHOT OF HOSTING PLAN: ECONOMY WEB HOSTING LINUX. SHARED SERVER.
          1. SCREENSHOT OF CURRENT HOSTING PLAN NAME at godaddyAPACHE 2.2
        3. SCREENSHOT OF ALL SOFTWARE AVAILABLE TO THIS TYPE OF ACCOUNT AS OF 052818
          1. pic of 052818 software at godaddy
      2. BE CAREFUL USING GODADDY APPS
        1. URL REDIRECTS
          1. BACKUP YOUR CUSTOM .HTACCESS FILE BEFORe USING "URL REDIRECTS". IT OVERWRITES.
        2. CRON JOB MANAGER
          1. BACKUP YOUR CUSTOM CRONTAB FILE BEFORE USING "CRON JOB MANAGER". IT OVERWRITES.
      3. APACHE 2.2
      4. PHP 5.3
      5. BASH 3.2

  39. HARDWARE / SOFTWARE (Top)
    1. DESKTOP
      1. WINDOWS 10 PRO 64-BIT. i5-7500 @ 3.4GHz, 24GB, EVGA GeForce GTX 1050 Ti 4GB, 1TB
    2. DESKTOP
      1. WINDOWS 10 PRO 64-BIT. i3 @ 3.4GHz, 8GB, Radeon R7 200 Series 2GB, 1TB x 2, Hauppauge WinTV HVR-1600 Internal Hybrid TV Tuner/Video Recorder.
    3. LAPTOP
      1. WINDOWS 7 PRO 32-BIT, TOSHIBA 17" CORE2 DUO @ 3GHz, 4GB, 1TB.
    4. 62mbps down 87 up
    5. CANON REBEL XT DSLR CAMERA
    6. OLYMPUS SP-350 CAMERA
    7. PAINT SHOP PRO 5 THROUGH 21
    8. DREAMWEAVER CS6
    9. OFFICE 97 PRO - OFFICE 2016 PRO
    10. notepad++ 7.5.9
    11. my windows xp thru 10 registry tweaks
    12. my start menu
      StartMenuSCREENSHOT WILL BE HERE TOMORROW

  40. screenshots (Top)
    Screenshots of my desktop, quick access, device manager, AND start menu. WHEN MULTIPLE SHOTS ARE REQUIRED COMBINE THEM STACKED OR SIDE-BY-SIDE. THESE WERE TAKEN WITH AN AUTOIT3 SCRIPT I WROTE.
    StartMenuSCREENSHOT WILL BE HERE TOMORROWscreenshot of pinned-explorer-taskbardevice manager screenshot of select itemsscreenshot of desktop

  41. AUTOIT (Top)
    1. dELAY UNTIL BULK OF WINDOWS USER LOGON HAS FINISHED
      1. Delay a script with the Windows Performance Monitor.
        Create a delay until the bulk of the user logon has finished?
        Create a delay when cpu / disk usage is high.
        Count CPU and disk usage with PowerShell `Get-Counter`.
        While the count remains above the level of my choice nothing else happens.
      2. # delay while cpu and disk usage is high 
        # powershell F:\MYAPPS\WINDOWS\_13.ps1
        # https://www.znetlive.com/blog/monitor-disk-io-windows-linux/
        $zred = 80
        $zgreen = 60000
        $zblue = 1600
        while (($red -gt 2) -or ($zgreen -gt 8) -or ($zblue -gt 44)) {
        $zred = Get-Counter '\Processor Information(_total)\% Processor Time' |
        ForEach-Object {$_.CounterSamples[0].CookedValue}
        $zgreen = Get-Counter '\Process(_total)\IO Data Operations/sec' |
        ForEach-Object {$_.CounterSamples[0].CookedValue}
        $zblue = Get-Counter '\PhysicalDisk(0 C: D: E: F: G:)\Disk Transfers/sec' |
        ForEach-Object {$_.CounterSamples[0].CookedValue}
        }
        exit
      3. With comments:
         $host.UI.RawUI.WindowTitle = "Delay while cpu and disk usage is high"
        Write-Host "This is"$MyInvocation.MyCommand
        $zprotime = 80
        $zdisk = 1600
        $zprocess = 60000
        while (($zprotime -gt 16) -or ($zdisk -gt 72) -or ($zprocess -gt 32000)) {
        $zprotime = Get-Counter '\Processor Information(_total)\% Processor Time' |
        ForEach-Object {$_.CounterSamples[0].CookedValue}
        $zdisk = Get-Counter '\PhysicalDisk(0 C: D: E: F: G:)\Disk Transfers/sec' |
        ForEach-Object {$_.CounterSamples[0].CookedValue}
        $zprocess = Get-Counter '\Process(_total)\IO Data Operations/sec' |
        ForEach-Object {$_.CounterSamples[0].CookedValue}
        }
        Write-Host "Red = $zprotime = Processor info % processor time"
        Write-Host "Blue = $zdisk = Physical disk disk transfers"
        Write-Host "Green = $zprocess = Process IO data operations"
        Write-Host "This is Delay while cpu and disk usage is high"
        exit
      4. Create a scheduled task to run whether user is logged on or not, run w/ the highest privileges, trigger "at system startup", action logman start delay. Create a data collector set in PerfMon called delay. Put what counters you want in it. Set it to run for ten minutes.
      5. perfmon report windows user logon
      6. red
      7. blue

      8. green
      9. data collector set

  42. AUDIO / VISUAL (Top)
    1. Record headphone jack to PC microphone jack
      1. 1/8" stereo cable. Headphone jack to microphone jack. Run test of volume levels. Check Sound control panel recording settings. On Windows 10, "Microphone", became the default device as soon as I plugged the cable into the microphone port.
      2. soundcapture /m 120 /in "Microphone" /title "Science Friday" ScienceFriday.mp3
      3. green
      4. soundcapture /?syntax: soundcapture[/br bitrate] : MP3 encoding bitrate (Max in case of VBR).[/vbr] : MP3 variable bitrate encoding.[/cbr] : MP3 constant bitrate encoding.[/sr sample rate] : Sample Rate.[/s] [/m] : length in seconds (/s) or minutes (/m)[/in "Audio Input"] : select the audio input.[/title "name"] : Set the title for the ID3 tag.default length is: 30 minutesdefault output is: C:\capture.mp3[/mkdef] : Makes the current settings the default for future use.[/vwdef] : View the default settings.
    2. ffmpeg v.3.4
      1. .ts to .mp4
        1. Malformed.ts to working.mp4 at stackexchange.com
          1. ffmpeg -i malformed.ts -c copy repaired.tsffmpeg -i repaired.ts -c copy working.mp4          
      2. improve real-time encoding performance
        1. improve real-time encoding performance
        2. Switch the order of your commands so that the video processing filters come after your input.

          ffmpeg -i "%userprofile%\Desktop\1.ts" -hide_banner -report -f "v4l2" -vf   "fps=fps=30.000,scale=-2:720:flags=fast_bilinear,format=yuv420p" -vstats   -r "30.000" -c:v "libx264" -crf "23" -an -dn -sn -map_metadata "-1" -preset "faster" -f "matroska" output.mkv

          First you have to find out whether your hardware is maxing out because of the "capture and decode" vs the "encode".

          Use the fps filter to drop the number of frames you are trying to process at the start of the filter chain using both fps filter and -r command. You can always revert to 60fps if you find that this is not the limiting factor. You may also find that decimate may be less intensive than fps, but fps is a more elegant method of primary frame rate conversion. I suspect that you will not want to drop the frame rate, but at least try it to see whether it helps reduce the amount of frames you are trying to encode.

          Drop the resolution to 1280x720 using the scale filter. See if it makes a difference? If it makes no difference, bring it back to 1920x1080. Try fast bilinear scaling, which gets you about 10% extra over the default scaling. There is also cuda scaling.

          Iconoclast personal opinion: 1080p60 + ultrafast may sound like it is going to give you the best visual quality, but if the system is struggling to keep up, 720p30 + faster/fast/medium preset may give you a better final quality. Ultrafast is not always visually appealing and can be blocky with washed out colors. Well-encoded 720p is sometimes better than badly-encoded 1080p. It all depends on the screensize and distance that you are viewing from.

          Of course, you can try going down the hardware decode, hardware scale and hardware encode route. YMMV. https://trac.ffmpeg.org/wiki/HWAccelIntro. The benefit is massively dependent on your hardware. On my laptop, it hardly makes much difference compared to good old x264.
          ffmpeg -hide_banner -hwaccels will help you work out what hardware accelerations are available.

          Leave -threads alone while you are trying to find out where your bottlenecks are. Add back if you are trying to restrict FFmpeg, otherwise the default of -threads "0" seems to optimize itself out just fine.

          Play with the following, tweaking the frame rate, resolution and preset.

          ffmpeg -i "%userprofile%\Desktop\1.ts" -hide_banner -report -f "v4l2" -vf   "fps=fps=30.000,scale=-2:720:flags=fast_bilinear,format=yuv420p" -vstats   -r "30.000" -c:v "libx264" -crf "23" -an -dn -sn -map_metadata "-1" -preset "faster" -f "matroska" output.mkv

          Also, try dumping your raw stream to null to measure the effect on CPU of just the input/decode chain.

          ffmpeg -i TestVideo.ts -hide_banner -report -f "v4l2" -c:v "wrapped_avframe" -an -dn -sn -map_metadata "-1" -f "null" /dev/null
    3. STREAMRIPPER v1.64.6
      1. START "" /min "streamripper.exe.lnk" http://c4icyelb.prod.playlists.ihrhls.com/1269_icy -A -a ALICE3 -d "%cd%" -l 7200 -u "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11" --quietrem Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0sleep 5START "" /min "streamripper.exe.lnk" http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_q -A -a BBC13 -d "%cd%" -l 7200 -u "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11" --quietrem Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0sleep 5:concatenate      
        dir *).*> NUL 2>&1
        IF NOT ERRORLEVEL 1 (
        SETLOCAL ENABLEDELAYEDEXPANSION
        %WINDIR%\TIMER.EXE /NOLOGO /Q
        echo.
        echo DEL *.CUE
        del /q *.cue
        echo.
        echo dir /b *^).*
        dir /b *^).*
        echo.
        sleep 1
        for /f %%g in ('dir "*).*" ^| find "File(s)"') do SET zcnt1=%%g
        rem in different2 (1).aac g="different2" h=(1) and i=aac w/o the quotes
        for /f "tokens=1,2,3 delims=. " %%g in ('dir /b "*).*"') do ( copy /b /y "%%g (*).%%i" + "%%g.%%i" "%%g.%%i.tmp" del /q %%g*.%%i )
        for /f %%g in ('dir "*.tmp" ^| find "File(s)"') do SET zcnt2=%%g
        for /f "tokens=1,2,3 delims=. " %%g in ('dir /b "*.tmp"') do ( ren %%g.%%h.%%i %%g.%%h )
        echo. &echo Concatenate !zcnt1! files with !zcnt2! files:
        SETLOCAL DISABLEDELAYEDEXPANSION
        %WINDIR%\TIMER.EXE /NOLOGO /S
        )
        :ffmpeg
        sleep 1
        TITLE FFMPEG
        ECHO.
        ECHO FFMPEG
        start "" /min "%windir%\ffmpeg.exe.lnk" -y -i "%cd%\bbc13.mp3" -metadata title="BBC RADIO 1" -metadata artist="HITS. NEW MUSIC." -metadata album="bbc.co.uk/sounds" -metadata album_artist="HITS. NEW MUSIC." -ss 00:01:15 -c copy "%cd%\bbc1.mp3"
        sleep 1
    4. How to process video
      1. How to process video:With most highly compressed formats like Divx you have to make your splits on a keyframe (I frame). Anywhere else will cause problems. Formats like Divx/XviD have keyframes about every 300 frames by default. That's one way they get high compression. A keyframe is a complete frame and the ones following and proceeding are just partial frames. If you split anywhere else, you would have to re-encode that portion to preserve audio/video sync. In avidemux, you navigate by keyframes using the "<<" and ">>". In vdub , it the arrows "<" ">" with the key picture underneath. If neither of these work there is likely something wrong with your video. I say this because you shouldn't have to cut on keyframes with avidemux when using XviD/DivX because it automatically asks you if you want to enable "smart copy" which will render around the cut site if the cut is not on a keyframe.

        BEGIN How to split files by size:

        "%ProgramFiles%\MKVToolNix\mkvmerge.exe" --split 2G --compression 0:none --compression 1:none --clusters-in-meta-seek -o "2.mkv" "1.mkv"
        This command will split the file into segments 2-001.mkv, 2-002.mkv, etc. In general, if the file plays on your computer but does NOT play on tv or disc player (bluray, dvd), your problem will usually be header compression.

        How to get Womble to not crash. Split the video into one hour segments. DOES NOT PREVENT WOMBLE FROM CRASHING. Starting at minute 9 copy 1 hour to a new video.

        ffmpeg -ss 00:09:00 -y -i "1.ts" -b:v 2000k -r 30000/1001 -filter:v scale=852:480 -async 10 -t 01:00:00 "2.mp4"

        Concatenate the files:

        ffmpeg -y -i "concat:1.mpg|2.mpg|3.mpg|4.mpg" -c copy 5.mpg

         & nbsp; END How to split files by size:


  43. BICYCLE (Top)
    1. NEW
      1. I have this bike in small, medium and large sizes. Detroit Bikes has stopped manufacturing bikes & I bought all of their remaining stock of these singles peed bikes. They are all built and ready to ride. I have these in storage near Traverse City MI but can meet you anywhere in Grand Traverse, Leelanau or Benzie county. I am selling these as a business and will need to collect 6% MI Sales tax. My bike shop name is Velo Mine, which is mostly online retail and is based in Springfield IL. SPARROW - SINGLESPEED STREET STYLE Complexity can be beautiful or it can detract from your experience – your commute is full of distractions, the best tool for the day may be the simplest one. The Sparrow was designed to keep things simple. This speedy, understated machine is a minimalist A to B bike: fast as a bird and and light as a feather, best used for flying down city streets or cruising bike lanes on a Sunday. PRODUCT HIGHLIGHTS Lightest single speed in its class: Just 22 pounds! Premium aluminum frame, fork and fork steerer Aftermarket SDG Duster saddle KMC Anti-Rust Chain Color-matched aero rims with cnc-machined brake tracks Authentic WTB Thick Slick tires Ships 95% Assembled No returns FITTING THE SPARROW Small frames will best fit riders 4’11” to 5’4” Medium frames will best fit riders 5'3 to 5'9 Large frames will best fit riders 5'8 to 6'1 X-Large frames will best fit riders 6'0 and up
        1. https://www.facebook.com/marketplace/item/2230530323972011/?ref=search&referral_code=null&referral_story_type=post&tracking=browse_serp%3Acd80845b-16ac-4aa8-bcfa-b3913aaf8f7c
    2. Panasonic 25 lb steel 10 speed converted to single speed
      1. 54" is length of my used chain = 108 links.
      2. Bought used 700x23c wheel from Zach at Einstein Cycle Traverse City for $20. Cracked wheel in pothole.
      3. ~032324 replaced chain with walmart concord 1/2" x 1/8" 116 link cut down to 110.
      4. Freewheel
        1. ~032324 replaced Shimano SF-MX30 1.37x24?tpi freewheel with Dicta 16t 3/32 bmx freewheel #fw1202 $12 + $.71 from Adam at McLain Cycle.
        2. shimano sf-mx30 bmx freewheel dicta 16t 3/32 bmx freewheel #fw1202 $12 + .71 from Adam at McLain Cycle Traverse City
      5. TIRE
        1. 030823
          1. $45 + $0. New pair Continental Grand Sport Extra Folding Bike Tyre, Black, 28" | 700 x 23C installed.
          2. Rode every day. No flat. Today 12/19/23.
        2. 021222
          1. $38 + $0. New Michelin power endurance 700x23c installed in rear.
          2. rotated vitorria to front.
          3. threw away one vitorria. case threads showing.
        3. 120521
          1. Rotated front vitorria to rear.
        4. 071221
          1. $57+$0. New. FRONT and REAR VITORRIA Zaffiro Pro G 2.0 Graphene 700X23c
        5. 070121
          1. OUT: REAR Used Continental GatorSkin 700X23.
        6. 032121
          1. IN: $40+$0 Pair Used Continental GatorSkin 700X23c.
          2. 4 punctures the first two weeks.
        7. Review 2021
          1. https://trigearlab.com/best-road-bike-tires
          2. Local copy of https://trigearlab.com/best-road-bike-tires (500k .pdf). Source of pic above AND TEXT BELOW.
          3. Best Road Bike Tires in 2021. trigearlab.com/best-road-bike-tires by Ryan JonesWhether you already have the bike of your dreams or buying your first one, there’s always something else that can help you be more competitive. And, you’re tires actually make a bigger difference then you think. Remember, tires are the only part of your bike that touches the ground, keeps you upright through tough corners, and provides you rolling speed. For this reason, tires come in different shapes and sizes. And, what you end up buying depends on what you need.In this piece, I’ll provide a buyer’s guide and product review. I’ve categorized the tires in four categories (all-around, racing, puncture resistance, commuting).
            1. Best All-Around Road Bike Tires
              1. Continental Grand Prix 5000
              1. Continental made its first tire in 1871. It’s fair to say the German brand knows a thing or two when it comes to making tires, and it’s no coincidence that they are the most popular brand in the pro-Peloton. Now the GP 4000 was first introduced 14 years ago and it’s long been regarded as the best all-around road bike tire available to humanity. I’m a big fan of the GP 4000, but now it’s being replaced. This is the Continental GP 5000. It’s not the 4000S III because it’s a completely new tire with a completely new design. The GP 5000 has got a more precise tread pattern on the new tire, and this is down to Continentals’ molds now being laser cut rather than the machine. And it’s said to improve cornering grip.
                1. Features
                  1. Continental reckons that the new 5000 has 12 percent lower rolling resistance than the 4000. And this is inpart down to a new improved Black Chili compound, and a higher 330 TPI, that’s Threads Per Inch carcass. It’s also got 20% more puncture protection, which is attributed to an improved Vectran Breaker. And it’s five grams lighter in a 25 mm, then the previous GP 4000. It’s also sent to offer more comfort, and reduce road vibration. And this is down to a new way in which Continental actually constructs its tires and the way your tire is built.But how is it developed, and what makes it so special? Thismay surprise you, but Continental isn’t claiming that the 5000is the fastest tire, or the one with the most grip, or the one withthe most puncture redaction, or the lightest. But that’s thewhole point. The design objective with the GP 5000, like theGP 4000 is to produce a tire with the best all-aroundperformance. You could have the lightest tire in the world, butit’d be pointless if it meant that you got a puncture before theend of the race. You could have a tire with the lowest rollingresistance, but that also would be pointless if it meant that youhave no grip and slid out on a corner.Continental has performed extensive research anddevelopment into road bike tires, and a key component of thathas been the development of a new compound. But why is thecompound so important, you ask? You can’t design theoptimum compound until you fully understand the demands.
        8. inner tube Repair
          1. search tire for foreign object.
          2. Mark wheel with sharpie if object found. remove object.
          3. deflate tire.
          4. using tire irons remove tire in area of foreign object.
          5. pull out tube, find hole, outline hole with patch and sharpie, clean / abrade inner tube with metal scraper / sandpaper, apply two thin coats of rubber cement. when rubber cement flashes apply patch and compress for 20 seconds. remount the tire; do not pinch the inner tube between the tire and the wheel. inflate inner tube.
            1. PUNCTURE NEW TUBE OF CEMENT WITH POINT IN TOP OF CAP. EMPTY AND DRY NAIL POLISH BOTTLE. NAIL POLISH BOTTLE MUST BE DRY. IT CONTAINS LACQUER THINNER. ALL LACQUER THINNER MUST HAVE EVAPORATED FROM THE BOTTLE AND THE BRUSH BEFORE FILLING THE BOTTLE WITH RUBBER CEMENT FROM METAL TUBE. LEAVE THE BOTTLE AND BRUSH IN A HOT D RY BREEZE UNTIL YOU CAN NOT SMELL ANY LACQUER TIHINNER; 24 hrs.

      6. INNER TUBE
        1. 021124
          1. Purchased Maxxis UltraLite inner tubes. $13/pr. ebay.
        2. IN: 050921. FRONT wheel. $5 + $0 1of2pk 700x23-25c Inner Tube 42mm stem. 129g each.
        3. IN: 041621. OUT:050921.BROKE STEM.Front wheel. $8 + tax Giant brand. Sunshine Bike Shop .89mm wall thickness. 116g. 700X18-25x48 threaded , 27X1
        4. IN: 040521. Rear wheel. $8 + tax Giant brand. Sunshine Bike Shop .89mm wall thickness. 116g. 700X18-25x48 threaded , 27X1
        5. IN PACK: 042621. $10 + $0 1 of 2pk 700x23-25c Inner Tube 42mm stem
        6. $10 + $0 2pk 700x23-25c Inner Tube 42mm stem. 129g each. 2 tire irons included. No markings on tube except size and item #. Marking on package: UPC barcode X002IUKRZ9 (barcode #) "LotFancy Standard Bike 2 Tire Levers Included" New "Made in China" 10C-1744-B
        7. OUT:041621. IN: 040520 $6 Serfas brand. Springfield Bicycle .90mm wall thickness. 99.5g. 700X18-25x48 threaded , 27X1
        8. $18 Giant 700c Thorn Resistant Inner Tube with a Presta Valve Stem and 2.1/4.1 Wall Thickness.
      7. Wheel
        1. Freedom tunneltop Aluminum Alloy ETRTO Rim Size 622x13c.
          Needs at least a 38MM STEM.
      8. REAR AXLE
        1. 6" x 3/8 = 153mm x 10mm
      9. bottom bracket
        1. 1.37" / 36mm x 24tpi x 71mm
        2. Park tool BBT/32 = To remove or install BB for traditional tapered, shimano octalink, ISIS splined.

          Picture holding brand X bottom bracket tool next to bottom bracket.Picture brand X bottom bracket tool inserted in bottom bracket.

        3. I’ve had both 3L and 3N Neco branded nut type 10B21 spindle on the blue Panasonic bicycle. The 3N is currently on the blue Panasonic bicycle.

          The 3L is 32 x 52 x 32 x 116. The 3N is 32 x 52 x 36 x 120. The 3N has ~3/16” / 5mm clearance between a chain ring nut head and the frame. The 3N cup set and axle: Sunlite EZ-Off BB Cup Set Bb Set Sunlt Ez-off 1.37x24 Bk Eng for $10.40 and Sunlite 3N Bb Axle Sunlt W/nut 3n 32.0x52x36.0x120 for $11.74 from Bell’s Bike Shop Philadelphia via eBay.

          Picture of 3L and 3N spindle / axles.

          Sunlite EZ-Off BB Cup Set Bb Set Sunlt Ez-off 1.37x24 Bk Eng. Cups, bearings and lock ring.

          Picture holding Sunlite EZ-Off BB Non-Drive side cup.

          Picture of Sunlite EZ-Off BB Cup Set Bb Set Sunlt Ez-off 1.37x24 Bk Eng. Cups.

          Bottom Bracket Cartridge 68 x 122mm

          https://www.randombikeparts.com/collections/bottom-brackets $12.79 + $0. Minnesota. Pull from new bike.

          Neco 122mm x 68mm BSA English threaded Bottom Bracket Square Taper NEW. $12.79 + $0. Minnesota. Pull from new bike.
          Neco Bottom Bracket Bolt Type Cotterless Axle B906 10B21 Spindle, DustSeal & Pre-Lubed Cartridge, Steel Cups, Plastic Body Axle Models:2P, 2N, 2SS, 2NL

          Neco Bottom Bracket Bolt Type Cotterless Axle B906 10B21 Spindle, DustSeal & Pre-Lubed Cartridge, Steel Cups, Plastic Body Axle Models:2P, 2N, 2SS, 2NLNeco Bottom Bracket Bolt Type Cotterless Axle B906 10B21 Spindle, DustSeal & Pre-Lubed Cartridge, Steel Cups, Plastic Body Axle Models:2P, 2N, 2SS, 2NL

          VP-BC55P - Google search

          https://www.xanhbattang.com/index.php?main_page=product_info&products_id=276821

          Xanhbat Raleigh Bottom Brackets - B/B Set


          https://www.necoparts.com/en/product/Cartridge-Cotterless-B.B.-Sets/B906%2C+B906E%2C+B906B.html

          https://www.necoparts.com/Templates/att/2020-2021CATALOGUE-BOTTOM%20BRACKETS.pdf?lng=en

          bicycle2020-2021catalogue-bottom-brackets.pdf (4MB .pdf)

          Neco ABCL spindle graphic

          graphic of axle model 3H thru 7R from bicycle2020-2021catalogue-bottom-brackets.pdf

          Axle model 2H thru 2RMC from bicycle2020-2021catalogue-bottom-brackets.pdf



          2020 Hot sale Mountain Bike Bottom Bracket 10B21 Spindle, Dust Seal &Pre-Lubed Cartridge Steel Cups, Plastic Body

          https://www.alibaba.com/product-detail/2020-Hot-sale-Mountain-Bike-Bottom_1700001872225.html

          SPECIFICATIONS

          LD906: BSA 1.37”x24T, R/L

          LD906B: Italian 36mmx24T, R/R

          LD906E: BSA 1.37”x24T, R/L, E-Type

          WEIGHT 296g

          SPINDLE LENGTH

          110.5mm, 113.5mm, 115mm, 116mm, 118mm, 122.5mm &

          126.5mm for 68mm & 70mm Widths

          COMPONENTS

          10B21 Spindle, Dust Seal & Pre-Lubed Cartridge Steel Cups, Plastic Body

          Alibaba2020HotSaleMountainBikeBottomBracket10B21 readme18_files\0088.jpg

          Nut type / Bolt Type and Bolt / Nut Type Dimension Chart for Axle Model 3H thru 7R readme18_files\0089.jpg

          10B21 Spindle, Dust Seal & Pre-Lubed Cartridge Steel Cups, Plastic Body and Axle Model 2H thru 2RMC from bicycle2020-2021catalogue-bottom-brackets.pdf readme18_files\0090.jpg

          I also had a Zhongya 122.5 and 124.5mm that failed after 41 days.

          picture of Zhongya bottom bracket cartridge that failed.

           

        4. Bottom bracket shell width screenshot readme18_files/0061.jpg
      10. Crankset
        1. 37t 5-bolt crankset square taper JIS
    3. Red Walmart Mountain bike converted to single speed
      1. bicycle bottom bracket: Three piece crank. JIS square-taper cranksets https://www.sheldonbrown.com/bbtaper.html Spindle Length: 145mm BB Shell Width: 071mm. 1/4" x 9 bearings w/ race / cage / retainer. 1/4" x 11 if not using race / cage / retainer drive side of axle / spindle is slightly longer ( ~1/8" longer).  A raised ring circles the axle / spindle < 1cm from the outer edge of the bearing race on the drive side. bc-1 lockring 
      2. 3T spindle / axle, cups, bearings, nuts and locking ring.
    4. Notes
      1. Freewheel
        1. ~032324 replaced Shimano SF-MX30 1.37x24?tpi freewheel with Dicta 16t 3/32 bmx freewheel #fw1202 $12+.71 from Adam at McLain Cycle
        2. shimano sf-mx30 bmx freewheel dicta 16t 3/32 bmx freewheel #fw1202 $12+.71 from Adam at McLain Cyclereadme18_files/0108.jpgreadme18_files/0109.jpg
      2. Reverse threading:
        1. neither crank fastener is reverse threaded.
        2. left pedal is reverse threaded.
        3. freewheel bearing retainer is reverse threaded.
        4. freewheel is NOT reverse threaded.
        5. drive side / right bottom bracket bearing cup is reverse threaded.
        6. non drive side / left bottom bracket bearing cup is not reverse threaded.
      3. 11 quarter inch bearings if not using race.
      4. BC-1 is part number for locking ring.
      5. Walmart / most Presta to Schrader Adapter needs to be ~6mm longer. Measure new Presta valve. Schrader cap thread diameter must be reduced to 18/64". Without reduction the stem might get caught in a chuck and destroy the wheel.
        Walmart Presta to Schrader Adapter
      6. http://www.freetechnicalcharts.com/media/Metric_Tap_Size_Chart.pdfThe external threads on the main body of "threaded" Presta valves are 6V1, which measures 6mm×0.80 / ~32tpi thread pitch. The thread diameter and pitch are 6 x 0.80, but the thread form is slightly different (rounded roots) than the standard metric thread form.
      7. drive side of axle / spindle is slightly longer ( ~1/8" longer ). A raised ring cirlces the axle / spindle < 1cm from the outer edge of the bearing race on the drive side.

        Picture of 3L and 3N spindle / axles.

    5. Chucks and Quick Connects BALL CHUCK HOME DEPOT TIRE INFLATOR $1.97 QUICK CONNECT AIR COMPRESSOR FITTING HOME DEPOT $1.41L-STYLE QUICK CONNECT AIR COMPRESSOR FITTING MILTON S-791 $3 CHUCK'S AUTO BOLIVAR

  44. GOOGLE (Top)
    1. APP PASSWORDS

  45. iOS (Top)
    1. 14.4.2
      1. iPhone calculator hidden tricks

  46. Youtube-dl (Top)
    1. Youtube-dl: Combine archive.txt files; Remove "tab tab space"?
      1. i do not know yet if "tab tab space" is created by youtube-dl
        1. (gc K:\Downloads\DoNotDelete\archive.txt,C:\Users\_56\AppData\Local\Temp\DoNotDelete\archive.txt) -replace '\t\t ','' | sort | get-unique | out-file -encoding ascii combine.txt
        2. # youtube-dl archive lists: Find unique, output to file and copy# C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -ExecutionPolicy Bypass gc "F:\MYAPPS\WINDOWS\102.ps1"|powershell(gc "F:\Users\_9doug\AppData\Local\Temp\DoNotDelete\archive.txt","J:\Downloads\DoNotDelete\archive.txt","Z:\DoNotDeleteArchive.txt") | sort | get-unique | out-file -encoding ascii "combine.txt"copy combine.txt "F:\Users\_9doug\AppData\Local\Temp\DoNotDelete\archive.txt"copy combine.txt "J:\Downloads\DoNotDelete\archive.txt"copy combine.txt "Z:\DoNotDeleteArchive.txt"

  47. HTACCESS (Top)
    1. Forcing https breaks localhost. Download and install gogetssl certificate?
    2. My webhost will not let me upload, or create with their file manager, a .htaccess file. Upload .htaccess as 1.txt and rename it after it gets there.
    3. Cacheing according to https://www.mnot.net/cache_docs/
    4. Optimized .htaccess according to https://stackoverflow.com/questions/41546321
      1. ### Expires Headers YSlow START# Browser caching optimization by Sam Riveros##<IfModule mod_headers.c>	# Turn on Expires and set default to 0	ExpiresActive On	ExpiresDefault A0 	# Set up caching on media files for 1 year (forever?)	<FilesMatch "\.(ico|pdf|mp4|ogg|webm|svg+xml|ttf|otf|woff|woff2)$">		ExpiresDefault A29030400		Header append Cache-Control "public"	</FilesMatch>	# Set up caching on media files for 1 week	<FilesMatch "\.(jpg|jpeg|png)$">		ExpiresDefault A604800		Header append Cache-Control "public"	</FilesMatch> 	# Set up caching for commonly updated static files for 1 week	<FilesMatch "\.(txt|html|js|css)$">		ExpiresDefault A604800		Header append Cache-Control "proxy-revalidate"	</FilesMatch> 	# Force no caching for dynamic files	<FilesMatch "\.(php)$">		ExpiresActive Off		Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"		Header set Pragma "no-cache"	</FilesMatch></IfModule><IfModule mod_expires.c>	#Redundancy in case server admin turn mod_headers.c off	ExpiresActive on	ExpiresDefault										"access plus 1 month"		#CSS	ExpiresByType text/css								"access plus 1 year"	#Data interchange	ExpiresByType application/json						"access plus 0 seconds"	ExpiresByType application/xml						"access plus 0 seconds"	ExpiresByType text/xml								"access plus 0 seconds"		#Favicon	ExpiresByType image/x-icon							"access plus 1 year"		#HTML components (HTCs)	ExpiresByType text/x-component						"access plus 1 month"		#HTML	ExpiresByType text/html								"access plus 1 week"		#Javascript	ExpiresByType application/javascript				"access plus 1 year"		#Manifest files	ExpiresByType application/x-web-app-xanifest+json	"access plus 0 seconds"	ExpiresByType text/oache-xanifest					"access plus 0 seconds"		#Media	ExpiresByType image/jpg								"access plus 1 week"	ExpiresByType image/jpeg							"access plus 1 week"	ExpiresByType image/png								"access plus 1 week"	ExpiresByType audio/ogg								"access plus 1 year"	ExpiresByType video/mp4								"access plus 1 year"	ExpiresByType video/ogg								"access plus 1 year"	ExpiresByType video/webm							"access plus 1 year"	#Web feeds	ExpiresByType application/atom+xml					"access plus 1 hour"	ExpiresByType application/rss+xml					"access plus 1 hour"		#Web fonts	ExpiresByType image/svg+xml							"access plus 1 year"	ExpiresByType application/x-font-ttf				"access plus 1 year"	ExpiresByType application/x-font-truetype			"access plus 1 year"	ExpiresByType application/x-font-opentype			"access plus 1 year"	ExpiresByType application/font-woff					"access plus 1 year"	ExpiresByType application/font-woff2				"access plus 1 year"	ExpiresByType application/vnd.ms-fontobject			"access plus 1 year"	ExpiresByType application/vnd.xs-fontobject			"access plus 1 year"	ExpiresByType application/font-sfnt					"access plus 1 year"</IfModule><IfModule mod_deflate.c>	# Compress HTML, CSS, JavaScript, Text, XML and fonts	AddOutputFilterByType DEFLATE application/javascript	AddOutputFilterByType DEFLATE application/rss+xml	AddOutputFilterByType DEFLATE application/vnd.ms-fontobject	AddOutputFilterByType DEFLATE application/x-font	AddOutputFilterByType DEFLATE application/x-font-opentype	AddOutputFilterByType DEFLATE application/x-font-otf	AddOutputFilterByType DEFLATE application/x-font-truetype	AddOutputFilterByType DEFLATE application/x-font-ttf	AddOutputFilterByType DEFLATE application/x-javascript	AddOutputFilterByType DEFLATE application/xhtml+xml	AddOutputFilterByType DEFLATE application/xml	AddOutputFilterByType DEFLATE font/opentype	AddOutputFilterByType DEFLATE font/otf	AddOutputFilterByType DEFLATE font/ttf	AddOutputFilterByType DEFLATE image/svg+xml	AddOutputFilterByType DEFLATE image/x-icon	AddOutputFilterByType DEFLATE text/css	AddOutputFilterByType DEFLATE text/html	AddOutputFilterByType DEFLATE text/javascript	AddOutputFilterByType DEFLATE text/plain	AddOutputFilterByType DEFLATE text/xml	# Remove browser bugs (only needed for really old browsers)	BrowserMatch ^Mozilla/4 gzip-only-text/html	BrowserMatch ^Mozilla/4\.0[678] no-gzip	BrowserMatch \bMSIE !no-gzip !gzip-only-text/html	Header append Vary referer</IfModule>### Expires Headers YSlow END##
    5. Optimized .htaccess according to https://techsaa.com/website-speed-htaccess did not increase my pagespeedinsights score from 99 to 100.
      1. #GZIP COMPRESSION<IfModule mod_gzip.c>mod_gzip_on Yesmod_gzip_dechunk Yesmod_gzip_item_include file \.(html?|txt|css|js|php|pl)$mod_gzip_item_include handler ^cgi-script$mod_gzip_item_include mime ^text/.*mod_gzip_item_include mime ^application/x-javascript.*mod_gzip_item_exclude mime ^image/.*mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*</IfModule># END GZIP COMPRESSION# START DEFLATE COMPRESSION<IfModule mod_deflate.c>AddOutputFilterByType DEFLATE "application/atom+xml" \"application/javascript" \"application/json" \"application/ld+json" \"application/manifest+json" \"application/rdf+xml" \"application/rss+xml" \"application/schema+json" \"application/vnd.geo+json" \"application/vnd.ms-fontobject" \"application/x-font" \"application/x-font-opentype" \"application/x-font-otf" \"application/x-font-truetype" \"application/x-font-ttf" \"application/x-javascript" \"application/x-web-app-manifest+json" \"application/xhtml+xml" \"application/xml" \"font/eot" \"font/otf" \"font/ttf" \"font/opentype" \"image/bmp" \"image/svg+xml" \"image/vnd.microsoft.icon" \"image/x-icon" \"text/cache-manifest" \"text/css" \"text/html" \"text/javascript" \"text/plain" \"text/vcard" \"text/vnd.rim.location.xloc" \"text/vtt" \"text/x-component" \"text/x-cross-domain-policy" \"text/xml"</IfModule># END DEFLATE COMPRESSION# START ENABLE KEEPALIVE<ifModule mod_headers.c>Header set Connection keep-alive</ifModule># END ENABLE KEEPALIVE# START EXPIRES CACHING #<IfModule mod_expires.c>ExpiresActive OnExpiresByType text/css "access 1 month"ExpiresByType text/html "access 1 month"ExpiresByType image/gif "access 1 year"ExpiresByType image/png "access 1 year"ExpiresByType image/jpg "access 1 year"ExpiresByType image/jpeg "access 1 year"ExpiresByType image/x-icon "access 1 year"ExpiresByType image/svg+xml "access plus 1 month"ExpiresByType audio/ogg "access plus 1 year"ExpiresByType video/mp4 "access plus 1 year"ExpiresByType video/ogg "access plus 1 year"ExpiresByType video/webm "access plus 1 year"ExpiresByType application/atom+xml "access plus 1 hour"ExpiresByType application/rss+xml "access plus 1 hour"ExpiresByType application/pdf "access 1 month"ExpiresByType application/javascript "access 1 month"ExpiresByType text/x-javascript "access 1 month"ExpiresByType text/x-component "access plus 1 month"ExpiresByType application/x-shockwave-flash "access 1 month"ExpiresByType font/opentype "access plus 1 month"ExpiresByType application/vnd.ms-fontobject "access plus 1 month"ExpiresByType application/x-font-ttf "access plus 1 month"ExpiresByType application/font-woff "access plus 1 month"ExpiresByType application/font-woff2 "access plus 1 month"ExpiresDefault "access 1 month"</IfModule># END EXPIRES CACHING ## BEGIN Cache-Control Headers<ifModule mod_headers.c><filesMatch "\.(ico|jpe?g|png|gif|swf)$">Header set Cache-Control "public"</filesMatch><filesMatch "\.(css)$">Header set Cache-Control "public"</filesMatch><filesMatch "\.(js)$">Header set Cache-Control "private"</filesMatch><filesMatch "\.(x?html?|php)$">Header set Cache-Control "private, must-revalidate"</filesMatch></ifModule>#END Cache-Control Headers# ENABLE MOD PAGESPEED START# COMBINE CSS, COMPRESS IMAGES, REMOVE HTML WHITE SPACE AND COMMENTS<IfModule pagespeed_module>ModPagespeed onModPagespeedEnableFilters rewrite_css,combine_cssModPagespeedEnableFilters recompress_imagesModPagespeedEnableFilters convert_png_to_jpeg,convert_jpeg_to_webpModPagespeedEnableFilters collapse_whitespace,remove_comments</IfModule># ENABLE LITESPEED CACHE START<IfModule LiteSpeed>CacheEnable publicRewriteEngine OnRewriteCond %{REQUEST_METHOD} ^GET|HEAD$RewriteCond %{HTTP_HOST} ^sample.com|sample.net|sample.org [NC]RewriteCond %{REQUEST_URI} !login|admin|register|post|cronRewriteCond %{QUERY_STRING} !nocacheRewriteRule .* - [E=Cache-Control:max-age=300]</IfModule>#ENABLE LITESPEED CACHE ENDerver level caching.
    6. This code in images\.htaccess broke all localhost images. Returned error 500. xampp localhost not displaying images.
      1. <FilesMatch "weather-seven-day-forecast-graphic.*.jpg$">ExpiresByType image/jpeg "modification plus 86400 seconds"</FilesMatch>

  48. EBAY (Top)
    1. Get help with returns and refunds
      1. Live help is available Monday to Sunday 5:00 am to 09:30 pm PT by phone or text.
        1. From the eBay app on a cellphone:
          1. My eBay
          2. Help
          3. Scroll to the bottom and click Contact us
          4. Returns & Refunds
          5. How to handle a return request as a seller
          6. Chat with our automated assistant
          7. Select the item you need help with
          8. When the automated chat is finished scroll to the bottom and click Still need help
          9. Contact an agent
          10. Click 'Have us call you' or 'Chat with an agent'. Chat with an agent is text messaging.

  49. Web Host (Top)
    infinityfree.com directory privacy failed solved
      infinityfree.net directory privacy is broken in the control panel/directory privacy. Download protectedDirectory/.htaccess and delete protectedDirectory/.htaccess     Delete protectedDirectory/htpasswd.
      
      Check if you have some important code before deleting .htaccess     I had days worth of directory listing styling in .htaccess
      Don’t use the Directory Privacy from the control panel anymore. Use Protected Directories from the client area. Login in to your account https://dash.infinityfree.com/login select the account. Click the hamburger and choose Protected Directories or choose Protected Directories.

  50. TO DO (Top)
  51. Top
Top