Articles on Trending Technologies

Technical articles with clear explanations and examples

Difference between Hibernate and Eclipse link

Himanshu shriv
Himanshu shriv
Updated on 15-Mar-2026 2K+ Views

Hibernate and EclipseLink are both Object-Relational Mapping (ORM) frameworks that implement the Java Persistence API (JPA) specification. While they serve the same fundamental purpose of mapping Java objects to relational databases, they have distinct differences in implementation and features. What is Hibernate? Hibernate is the most popular JPA implementation, developed by Red Hat. It provides robust ORM capabilities and includes additional features beyond the standard JPA specification. Hibernate has been widely adopted in enterprise applications due to its maturity and extensive documentation. What is EclipseLink? EclipseLink is an open-source JPA implementation developed by the Eclipse Foundation. ...

Read More

How can I check JavaScript arrays for empty strings?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 401 Views

In JavaScript, arrays can contain empty strings alongside other values. Here are several methods to check for and handle empty strings in arrays. Method 1: Using a Loop to Find Empty Strings The most straightforward approach is to iterate through the array and check each element: var studentDetails = new Array(); studentDetails[0] = "John"; studentDetails[1] = ""; studentDetails[2] = "Smith"; studentDetails[3] = ""; studentDetails[4] = "UK"; function arrayHasEmptyStrings(studentDetails) { for (var index = 0; index < studentDetails.length; index++) { if (studentDetails[index] == "") ...

Read More

How to force Chrome's script debugger to reload JavaScript?

Govinda Sai
Govinda Sai
Updated on 15-Mar-2026 4K+ Views

To force Google Chrome's script debugger to reload JavaScript files, you have several methods depending on your debugging needs. This is essential when cached files prevent you from seeing your latest code changes. Method 1: Using Dev Tools Sources Panel The most direct approach is through Chrome's Developer Tools: Open Dev Tools (F12 or right-click → Inspect) Click on the Sources tab Find your JavaScript file in the file tree Right-click the file and select "Reload" or "Refresh" Method 2: Hard Refresh ...

Read More

What is the role of clientX Mouse Event in JavaScript?

Nancy Den
Nancy Den
Updated on 15-Mar-2026 473 Views

The clientX property returns the horizontal (x-axis) coordinate of the mouse pointer relative to the current viewport when a mouse event occurs. Unlike other coordinate properties, clientX is measured from the left edge of the browser's visible area, not including scrollbars. Syntax event.clientX Return Value Returns a number representing the horizontal pixel position of the mouse pointer relative to the viewport's left edge. Example: Getting Mouse Coordinates on Click clientX Mouse Event ...

Read More

HTML5 Canvas Font Size Based on Canvas Size

George John
George John
Updated on 15-Mar-2026 946 Views

When working with HTML5 Canvas, you often need to scale font sizes dynamically based on the canvas dimensions to maintain proportional text across different screen sizes. The Problem Fixed font sizes don't adapt when canvas dimensions change, making text too small on large canvases or too large on small ones. Solution: Proportional Font Scaling Use a ratio-based approach to calculate font size relative to canvas width: var fontBase = 800; // Base canvas width var fontSize = 60; // Desired font size at base width function getFont(canvas) { ...

Read More

Uniquely identify files before uploading with the HTML5 file API

Nitya Raut
Nitya Raut
Updated on 15-Mar-2026 274 Views

While making a file uploader using HTML5 file API, we want to be sure that no duplicate files are uploaded based on actual data. This prevents wasting storage space and bandwidth by uploading identical files multiple times. Calculating a hash with MD5 is not an efficient method as all that happens on the client side and is time-consuming. There is actually no perfect shortcut for this task. Method 1: Basic File Properties Check The simplest approach is to compare basic file properties like name, size, and last modified date: document.getElementById('fileInput').addEventListener('change', function(event) ...

Read More

How to find the number of links in a document in JavaScript?

Lokesh Yadav
Lokesh Yadav
Updated on 15-Mar-2026 1K+ Views

The document.links property in JavaScript provides access to all links in a document. It returns a collection of and elements that contain an href attribute. Syntax To get the total number of links in a document, use: document.links.length The document.links property returns an HTMLCollection that behaves like an array, allowing you to access individual links by index and get the total count using the length property. Example 1: Basic Link Count Here's a simple example to count the links in a document: JavaScript ...

Read More

Create empty array of a given size in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 2K+ Views

In JavaScript, you can create an empty array of a given size using several approaches. The most common method is using the Array() constructor. Using Array Constructor The new Array(size) creates an array with the specified length, but all elements are undefined (empty slots). var numberArray = new Array(5); console.log("Array length:", numberArray.length); console.log("Array contents:", numberArray); console.log("First element:", numberArray[0]); Array length: 5 Array contents: [ ] First element: undefined Filling the Array with Values After creating an empty array, you can assign values to specific positions or replace the entire ...

Read More

Find the Symmetric difference between two arrays - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 317 Views

In Mathematics, the symmetric difference of two sets, say A and B is represented by A △ B. It is defined as the set of all elements which belong either to A or to B but not to both. For example: const A = [1, 2, 3, 4, 5, 6, 7, 8]; const B = [1, 3, 5, 6, 7, 8, 9]; The symmetric difference of A and B will be: const diff = [2, 4, 9] Using For Loops with indexOf() This approach iterates through both arrays and checks ...

Read More

How to format JavaScript date into yyyy-mm-dd format?

Anvi Jain
Anvi Jain
Updated on 15-Mar-2026 4K+ Views

To format a JavaScript date into "yyyy-mm-dd" format, you can use several methods. The most common approaches are using toISOString() with substring extraction or building the format manually. Using toISOString() Method The toISOString() method returns a date in ISO 8601 format. To get just the "yyyy-mm-dd" part, extract the first 10 characters: JavaScript Date Formatting var date = new Date(); var formattedDate = date.toISOString().substring(0, 10); ...

Read More
Showing 18211–18220 of 61,297 articles
Advertisements