AmitDiwan has Published 11365 Articles

Enter key press event in JavaScript?

AmitDiwan

AmitDiwan

Updated on 15-Sep-2023 02:16:05

25K+ Views

For ENTER key press event, you can call a function on −onkeypress=”yourFunctionName”Use the ENTER’s keycode 13.Example Live Demo Document    function enterKeyPressed(event) {       if (event.keyCode == 13) {          console.log("Enter key is pressed"); ... Read More

How to display Base64 images in HTML?

AmitDiwan

AmitDiwan

Updated on 14-Sep-2023 21:56:10

24K+ Views

To display images encoded with Base64, you need to get the base64 encoded string and use the img element. This prevents the page from loading slowly and saves the web browser from additional HTTP requests. Set the base64 image in the src attribute of the . Let’s say we have ... Read More

PHP program to check if a number is prime or not

AmitDiwan

AmitDiwan

Updated on 13-Sep-2023 14:35:19

33K+ Views

To check if a number is prime or not, the code is as follows −Example Live DemoOutputIt is a prime numberA function named check_prime() is used to check if the number is prime or not. A number that needs to be checked for being prime is passed as a parameter to ... Read More

How to Detect User Timezone in JavaScript?

AmitDiwan

AmitDiwan

Updated on 13-Sep-2023 04:03:31

39K+ Views

To detect the user timezone with the name of the timzone itself, use the Internationalization API. This gives the name of the Timezone in which the user and the browser is being worked on. Detect Exact Timezone with Name Example To get the exact timezone name, we will use the ... Read More

How to import local json file data to my JavaScript variable?

AmitDiwan

AmitDiwan

Updated on 12-Sep-2023 00:57:00

31K+ Views

We have an employee.json file in a directory, within the same directory we have a js file, in which we want to import the content of the json file.The content of employees.json −employees.json"Employees" : [    {       "userId":"ravjy", "jobTitleName":"Developer", "firstName":"Ran", "lastName":"Vijay",       "preferredFullName":"Ran Vijay", "employeeCode":"H9", ... Read More

How to call a function that returns another function in JavaScript?

AmitDiwan

AmitDiwan

Updated on 10-Sep-2023 08:04:26

35K+ Views

We will call a function by referencing its name and adding parentheses after it. If the function we are calling returns another function (it does in our case), we will need to assign it to a variable or call it immediately. In the future, we will need to make ... Read More

How to adjust the width and height of an iframe to fit with content in it HTML?

AmitDiwan

AmitDiwan

Updated on 02-Sep-2023 14:07:36

80K+ Views

We can adjust the width and height of an iframe by using CSS to set the dimensions. This can be done by setting the width and height properties to a specific value or to a percentage of the parent container. Additionally, we can use JavaScript to dynamically adjust the dimensions ... Read More

DateTime.Compare() Method in C#

AmitDiwan

AmitDiwan

Updated on 02-Sep-2023 13:40:32

46K+ Views

The DateTime.Compare() method in C# is used for comparison of two DateTime instances. It returns an integer value, 0 − If date1 is later than date2SyntaxFollowing is the syntax −public static int Compare (DateTime d1, DateTime d2);Above, d1 and d2 are the two dates to be compared.ExampleLet us now see ... Read More

Starting and Stopping MySQL Server

AmitDiwan

AmitDiwan

Updated on 02-Sep-2023 10:40:03

76K+ Views

Let us understand how MySQL server can be started and stopped on Linux and Windows −Linux – Start and Stop ServerOn Linux, the start and stop can be done from the command line as shown below −/etc/init.d/mysqld start /etc/init.d/mysqld stop/etc/init.d/mysqld restartLinux – Service CommandsSome Linux types offer service command as ... Read More

Python - Read csv file with Pandas without header?

AmitDiwan

AmitDiwan

Updated on 26-Aug-2023 08:31:46

35K+ Views

To read CSV file without header, use the header parameter and set it to “None” in the read_csv() method.Let’s say the following are the contents of our CSV file opened in Microsoft Excel −At first, import the required library −import pandas as pdLoad data from a CSV file into a ... Read More

Advertisements