Posts

Replace word using dictionary Program

Replace word using dictionary Program  to replace word using dictionary javascript Here is an example of a program in JavaScript that replaces a word in a string using a dictionary:   const dictionary = { "{NANE}": "Jhon", "{DESIGNATION}": "Software Engineer", };  const replaceWord = (sentence, dictionary) =>  {   let newSentence = sentence;  for (let key in dictionary) {       newSentence = newSentence.replace(key, dictionary[key]);  }  return newSentence;  };  const sentence = "My name is {NAME} and I am {DESIGNATION}";  console.log(replaceWord(sentence, dictionary));  // Output: "My name is John and I am SoftwareEngineer. "  In this example, the dictionary object contains key-value pairs of words to be replaced and their replacements. The replaceWord function takes a sentence and the dictionary as input, and loops through the keys in the dictionary. For each key, it replaces all occurrences...

change the pitch of an audio file using ffmpeg

  Change Audio Pitch FFmpeg Change audio pitch ffmpeg To change the pitch of an audio file using ffmpeg, you can use the "asetrate" filter. For example, to increase the pitch by one octave (double the frequency), you can use the following command: ffmpeg -i input.mp3 -filter:a "asetrate=2*44100" output.mp3 An octave is a musical interval that spans 12 semitones on a standard piano keyboard. Doubling the frequency of a note results in an increase in pitch by one octave. A semitone is the smallest musical interval commonly used in Western tonal music, and it is equal to the interval between two adjacent notes on a piano or other musical keyboard. It is also known as a half step or a half tone. For example, the interval between C and C# is a semitone. In Western music, there are 12 semitones in an octave, which is the interval between two notes that have the same letter name but are separated by an interval of 12 pitch classes. To decrease the pitch by one octave (half...

Convert Json to Table

Image
 Convert Json to Table click below to open converter Json to Table Tip : open console of browser. Right click and click on inspect or F12 to open the console  Use JSON.stringify method to convert Object to Json String Now copy the json string and Past it to Json to Table and click on convert  This will help to prevent Json Invalid data error. eg: var users = [     {         id: 1,         name: 'bruce'     },     {         id: 2,         name: 'peter'     } ] JSON.stringify(users) ' [{"id":1,"name":"bruce"},{"id":2,"name":"peter"}] '

Add debouncing to the search input in Angular using RxJS and the debounceTime operator.

Image
In Angular, you can use the (click) event binding to create a denounce functionality. Debouncing is a technique that delays the execution of a function until a specified amount of time has passed since the last time the function was called. Here's an example of how to implement a debounce function in Angular: 1. Import the debounceTime operator from the rxjs/operators library: 2. Create a subject to emit the click events: 3. Subscribe to the subject and use the debounceTime operator to delay the execution of the function: 4. Add the (click) event binding to the HTML element and call the next() method of the subject to emit the click event: This will create a debounced click functionality that delays the execution of the function by 500 milliseconds after the last click event. You can adjust the debounce time to suit your needs.      import { Subject , Subscription } from 'rxjs' ;      import { debounceTime , distinctUntilChanged } from 'rxj...

System-related information_schema Sql queries

Image
  The information_schema schema is a special schema that is present in all modern SQL database management systems, including MySQL, PostgreSQL, SQL Server, and Oracle. It contains a set of read-only tables that provide metadata information about the database system itself. This metadata includes information about databases, tables, views, columns, indexes, constraints, and more. Developers and database administrators can use the information_schema schema to obtain information about the database system itself. This information can be used for various purposes, such as generating reports, auditing, debugging, and optimizing queries. Similar other useful system-related views and tables that are useful for database administration: sys.databases : This view contains information about all the databases on a SQL Server instance, such as their names, IDs, and creation dates. sys.objects : This view contains information about all the objects in a SQL Server database, such as tables, views, ...

How to add minutes in javascript date object

Image
  This code snippet you can use to add or subtract minute from JavaScript date object  function   addMinute ( date ,   min )   {      let   nD  =  new   Date ( date . getTime () +  min  *  6e4 )      return   nD ; } To add minutes call addMinute method and pass date param in which you want to add the minutes      let   date  =  new   Date () ;      addMinute ( date ,   5 ) To subtract the minute use this method as demonstrate below      let   date  =  new   Date () ;      addMinute ( date ,  - 5 ) Output:

how to fix smart card not inserted properly Videocon d2h

Image
Let me share an experience with you. I was facing a recurring problem with my d2h set-top box where I would frequently see an error message on my TV screen. To temporarily fix the issue, I would turn off and on the set-top box. I also contacted Videocon d2h's customer care for help. After verifying my d2h VC number for identification, the customer care executive tried to reinitiate the service multiple times, but the issue persisted. They suggested sending an engineer to fix the problem for a charge of 200 rupees, but I decided to tackle the issue myself. Since the smart card in the d2h set-top box cannot be seen from outside, I decided to open it up using a screwdriver. Inside, I found a card inserted on the motherboard of the set-top box that resembled an old mobile SIM card and had a similar SIM slot. I hope this information helps someone facing a similar issue. [IMG: Smart card and slot] Upon opening the card slot, I noticed that there were instructions ...