If you have a very large CSV and don’t want a library:

Browser: Native Streaming (no library)

<script>
async function streamCSV(url) {
  const response = await fetch(url);
  const reader = response.body.getReader();
  const decoder = new TextDecoder();
  let  columns;
  let buffer = '';
  i = 0;
  while (true) {
    const { value, done } = await reader.read();
    if (done) break;

    buffer += decoder.decode(value, { stream: true });
    let lines = buffer.split('\n');
    buffer = lines.pop(); // keep incomplete line

    for (const line of lines) {
       columns = line.split(',');
       j = 0;
       while(j < columns.length)
       {
        if(columns[j].search("Android") >= 0)
      {
      console.log(columns[j]); // process each row

      i ++;
      break;
      }

        j++;
       }
      
    }
  }

  if (buffer.trim()) {
    console.log(buffer.split(','));
   
  }
  console.log("done"+i+" - " +columns.length);
}

streamCSV('cal_activity.csv');
</script>

How to prevent video from downloading on website

Preventing video downloads on a website can be challenging, as users can always find ways to capture or download content. However, you can implement several strategies to make it more difficult:

1. Use Streaming Protocols

  • HLS (HTTP Live Streaming) or DASH (Dynamic Adaptive Streaming over HTTP): These protocols break videos into small segments, making it harder to download the entire file easily.

2. Disable Right-Click

  • Use JavaScript to disable right-click options on the video element to prevent users from accessing context menus.
document.addEventListener('contextmenu', function(e) {
    e.preventDefault();
});

3. Use a Video Player with Protection Features

  • Implement a video player that offers built-in protections against downloading, such as encrypted streaming or watermarking.

4. Watermark Your Videos

  • Include a visible watermark in your videos to discourage unauthorized use. This won’t prevent downloads but can deter misuse.

5. Implement Token Authentication

  • Use a server-side token system that generates temporary URLs for video access. This limits the time a video can be accessed and prevents direct linking.

6. Set Proper HTTP Headers

  • Configure your server to send headers like Content-Disposition: attachment; filename="video.mp4" to discourage direct downloads.

7. Restrict Access via Referrer

  • Only allow video playback from your domain by checking the HTTP referrer. This prevents direct links from other sites.

8. Use DRM (Digital Rights Management)

  • Implement DRM solutions to protect your content, though this may be more complex and costly.

Conclusion

While no method is foolproof, combining several of these techniques can significantly reduce the chances of users downloading your videos.

How can I translate only one DIV using translate.google.com

<body class="notranslate">

<h1>no translate paragraph</h1>

<h1 class="translate"> i want to translate the line</h1>
</body>
<p id="tr_title" class="translate"></p> 

<div id="google_translate_element" class="alert alert-dismissible fade show text-center bg-theme" role="alert">
 
</div>
<script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'hi',includedLanguages : 'hi,zh-CN,en'}, 'google_translate_element');
  //htext = document.getElementById("tr_title").value;
  //navigator.clipboard.writeText(htext);
}//, includedLanguages : 'hi,zh-CN,en'
window.onload = function() {
 $(".VIpgJd-ZVi9od-l4eHX-hSRGPd").html("Aditya");
};
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
<script>
function myFunction() {
  let text = document.getElementById("inputTitle").value;
  document.getElementById("tr_title").innerHTML = text;
 
}
</script>

check width of screen in javascript

const width  = window.innerWidth || document.documentElement.clientWidth || 
document.body.clientWidth;
const height = window.innerHeight|| document.documentElement.clientHeight|| 
document.body.clientHeight;

console.log(width, height);

javascript get value from get url

//url example https://example.com/page?action=nexttoresult
var url_string = location.href; 
var url = new URL(url_string);
var action = url.searchParams.get("action");
console.log(action);

How to read json data in javascript

<script>
  function readTextFile(file, callback) {
    var rawFile = new XMLHttpRequest();
    rawFile.overrideMimeType("application/json");
    rawFile.open("GET", file, true);
    rawFile.onreadystatechange = function() {
        if (rawFile.readyState === 4 && rawFile.status == "200") {
            callback(rawFile.responseText);
        }
    }
    rawFile.send(null);
}

//usage:
var data;
readTextFile("tarot_card_detail.json", function(text){
     data = JSON.parse(text);
    for (const key in data) {
      $("#tarot_card_holder").append('<div class="card" >\
  <img  class="img-fluid card-img-top" style="height:300px" src="https://cdn.pixabay.com/photo/2021/02/15/07/46/empress-6016923_1280.jpg" alt="Card image cap">\
    </div>');
     // console.log(data[key]['name']+" "+data[key]['value']);
    }
   // console.log(data);
});
</script>

how to use ckeditor in html

<script src="https://cdn.ckeditor.com/ckeditor5/40.0.0/classic/ckeditor.js"></script>
<textarea class="form-control" name="description" id="description" rows="10"><?php echo openssl_decrypt($notes[$key]['description'],"AES-128-ECB",$enc_key);//base64_decode($notes[$key]['description']);?></textarea>

<script>              
    ClassicEditor
        .create( document.querySelector( '#description' ),
        {
          ckfinder: {
            //uploadUrl: '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files&responseType=json'
        },
      toolbar: {
       items: [
        'selectAll', 'undo', 'redo', 'bold', 'italic', 'blockQuote', 'link', 'heading', 'imageTextAlternative', 'toggleImageCaption', 'imageStyle:inline', 'imageStyle:alignLeft', 'imageStyle:alignRight', 'imageStyle:alignCenter', 'imageStyle:alignBlockLeft', 'imageStyle:alignBlockRight', 'imageStyle:block', 'imageStyle:side', 'imageStyle:wrapText', 'imageStyle:breakText', 'indent', 'outdent', 'numberedList', 'bulletedList', 'mediaEmbed', 'insertTable', 'tableColumn', 'tableRow', 'mergeTableCells'
    ],
    shouldNotGroupWhenFull: false
      },
        })
        .then( editor => {
       // console.log( Array.from( editor.ui.componentFactory.names()));
    })
    .catch( error => {
            console.error( error );
        });
</script>

Code for create Slug using javascript

<script>
  $("#inputSlug").keyup(function() {
  var Text = $(this).val();
  Text = Text.toLowerCase();
  Text = Text.replace(/[^a-zA-Z0-9]+/g,'-');
  var Text = Text.replace(/^\-+|\-+$/g, "");
  $("#inputSlug").val(Text);        
});
</script>

get inner text of selected option jQuery

$('#language_id').change(function (e) { 
    e.preventDefault();
    $('#language_name').val($('#language_id option:selected').text());
    console.log($('#language_id option:selected').text());
   });