Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
HTML5 audio not playing in PhoneGap App
HTML5 audio may not play in PhoneGap (Apache Cordova) apps due to Content Security Policy restrictions or missing Android permissions. Here are the solutions to resolve audio playback issues. Content Security Policy Configuration The most common cause is a restrictive Content Security Policy. Add this meta tag to your index.html file in the section: The key part is media-src * which allows audio from any source, including local files and remote URLs. Android Permissions Setup Add the following permissions to your AndroidManifest.xml file: ...
Read MoreChange the color of right border with CSS
The border-right-color CSS property allows you to change the color of an element's right border specifically, without affecting the other borders. Syntax border-right-color: color; Parameters The color value can be specified using: Color names: red, blue, green Hex values: #FF0000, #00FF00 RGB values: rgb(255, 0, 0) HSL values: hsl(0, 100%, 50%) Example: Basic Right Border Color .demo { border: 3px solid black; ...
Read MoreWhat blocks Ruby, Python to get Javascript V8 speed?
Nothing technically prevents Ruby and Python from achieving JavaScript V8 speeds. The performance gap exists primarily due to differences in optimization investments and language design choices rather than fundamental limitations. The V8 Advantage Google's V8 engine benefits from massive engineering resources and specific optimizations: Just-In-Time (JIT) compilation: Converts JavaScript to optimized machine code at runtime Hidden class optimization: Optimizes object property access patterns Inline caching: Speeds up method calls and property lookups Garbage collection tuning: Minimizes pause times during memory cleanup Ruby and Python Constraints Several factors limit Ruby and Python performance compared ...
Read MoreJavaScript array.values()
The array.values() method returns an iterator object that contains all the values of an array. This method provides a way to iterate through array values using for...of loops or iterator methods. Syntax array.values() Parameters This method takes no parameters. Return Value Returns an Array Iterator object containing the values of the array. Example: Using array.values() with for...of Loop Array Values Example JavaScript array.values() ...
Read MoreJavaScript code to de-select text on HTML page.
In JavaScript, you can deselect or clear text selections on an HTML page using the window.getSelection().removeAllRanges() method. This is useful for creating interactive interfaces where you want to programmatically clear user text selections. The Selection API The Selection API provides methods to work with text selections in the browser. The window.getSelection() object represents the current text selection, and removeAllRanges() clears all selected ranges. Syntax window.getSelection().removeAllRanges(); Example Deselect Text Example ...
Read MoreDisplay array items on a div element on click of button using vanilla JavaScript
To display array items in a div element when a button is clicked, we need to iterate through the array and append each element to the target div. This is commonly done using JavaScript's forEach() method or a simple loop. Basic Approach The core concept involves selecting the target div using getElementById() and updating its innerHTML property with array elements: const myArray = ["stone", "paper", "scissors"]; const embedElements = () => { myArray.forEach(element => { document.getElementById('result').innerHTML += ...
Read MoreHow to disallow altering of object variables in JavaScript?
JavaScript provides Object.freeze() to make objects immutable, preventing addition, deletion, or modification of properties. This is useful when you need to protect object data from accidental changes. Syntax Object.freeze(object) Basic Example When an object is frozen, attempts to modify its properties are silently ignored: const canNotChangeTheFieldValueAfterFreeze = { value1: 10, value2: 20 }; Object.freeze(canNotChangeTheFieldValueAfterFreeze); // Attempt to change property (will be ignored) canNotChangeTheFieldValueAfterFreeze.value1 = 100; console.log("After changing the field value1 from 10 to 100 = " + canNotChangeTheFieldValueAfterFreeze.value1); ...
Read MoreSplit string into groups - JavaScript
Given a string that consists of alphabets, numbers, and special characters, we need to split it into three separate strings based on character type. We'll create three strings where: S1 contains all alphabets from the original string S2 contains all numbers from the original string S3 contains all special characters from the original string The characters in each resulting string maintain the same order as they appear in the input string. Example Implementation const str = "Th!s String C0nt@1ns d1fferent ch@ract5rs"; const ...
Read MoreHow to make a Website step by step?
A website is a collection of web pages containing content, images, videos, and other elements, accessible through a unique domain name and hosted on a web server. Creating a website involves several key steps from planning to deployment. Step 1: Choose and Register a Domain A domain is the web address users type to access your website (e.g., www.tutorialspoint.com). Each domain is unique and serves as your website's identity on the internet. Purchase a domain name from registrars like GoDaddy, Namecheap, or other hosting companies. Here's how a domain appears in the browser address bar: ...
Read MoreHow to get the length of a string in JavaScript?
In this tutorial, we will learn how to get the length of a string in JavaScript. While working with strings in JavaScript, we often need to know the number of characters present in them. Understanding how to calculate string length helps with text processing, validation, and data manipulation. There are different ways to get the length of a string, but the most common approach is using the built-in length property. Using the string.length Property The simplest and most efficient way to get the length of a string in JavaScript is using the length property. Syntax ...
Read More