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 by Ramu Prasad
Page 2 of 5
How to search the querystring part of the href attribute of an area in JavaScript?
To get the querystring from the href attribute of an area element, use the search property. This property returns the query portion of the URL, including the question mark. Syntax areaElement.search Return Value Returns a string containing the query portion of the href URL, including the leading question mark (?). Returns an empty string if no query parameters exist. Example ...
Read MoreSet the Background Attachment with CSS
The background-attachment property controls whether a background image scrolls with the content or remains fixed in the viewport. This CSS property is useful for creating parallax effects or keeping decorative backgrounds stationary. Syntax background-attachment: value; Property Values Value Description scroll Background scrolls with content (default) fixed Background stays fixed in viewport local Background scrolls with element's content Example: Fixed Background This example demonstrates a fixed background that remains stationary while content scrolls: ...
Read MoreHow to concatenate several strings in JavaScript?
JavaScript provides multiple methods to concatenate several strings. The most common approaches include using the + operator, template literals, Array.join(), and the concat() method. Method 1: Using the + Operator The simplest way to concatenate strings is using the + operator: let str1 = "John"; let str2 = "Amit"; let str3 = "Sachin"; ...
Read MoreHow to label a block in JavaScript?
A block statement groups zero or more statements. In languages other than JavaScript, it is known as a compound statement. Labels in JavaScript provide a way to identify blocks of code, which is particularly useful for controlling nested loops with break and continue statements. Syntax Here's the basic syntax for a block statement: { // List of statements } To add a label to a block, use the following syntax: labelName: { // Statement list } Labeling Loops Labels are most commonly used ...
Read MoreList of Best JavaScript libraries?
JavaScript libraries provide pre-written code to simplify common programming tasks, enhance functionality, and accelerate development. Here are some of the most popular and widely-used JavaScript libraries across different categories. Frontend UI Libraries jQuery jQuery is a fast and lightweight JavaScript library created by John Resig in 2006 with the motto "Write less, do more". It simplifies HTML document traversing, event handling, animations, and Ajax interactions for rapid web development. // jQuery example - DOM manipulation $(document).ready(function() { ...
Read MoreHow to redirect to another webpage using JavaScript?
The window.location object contains the current location or URL information. We can redirect users to another webpage using the properties of this object. The window prefix is optional and can be omitted. JavaScript provides three main methods to redirect users to another webpage: location.href - Sets or returns the complete URL of the current page location.replace() - Replaces the current document with a new one (no back button history) location.assign() - Loads a new document (keeps back button history) Syntax location.href = "url"; location.replace("url"); ...
Read MoreList of Common Reasons for Segmentation Faults in C/C++
The main reason for segmentation fault is accessing memory that is either not initialized, out of bounds for your program or trying to modify string literals. These may cause a segmentation fault though it is not guaranteed that they will cause a segmentation fault. Here are some of the common reasons for segmentation faults − Accessing an array out of bounds Dereferencing NULL pointers Dereferencing freed memory Dereferencing uninitialized pointers Incorrect use of the "&" (address of) and "*" (dereferencing) operators Improper formatting specifiers in printf and scanf statements Stack overflow Writing to read-only memory Common ...
Read MoreConverting a file into a byte array in SAP ABAP
Converting a file into a byte array in SAP ABAP is a common requirement when you need to process binary data or transfer files. The following approach reads a file in binary mode and stores its content as an xstring byte array. Method Using Dataset Operations Here is a code snippet that demonstrates how to convert a file into a byte array − data: f_line type xstring. " to get line by line content data: f_file type ...
Read MoreSingle level inheritance in Java
Single Level inheritance - A class inherits properties from a single class. For example, Class B inherits Class A.Exampleclass Shape { public void display() { System.out.println("Inside display"); } } class Rectangle extends Shape { public void area() { System.out.println("Inside area"); } } public class Tester { public static void main(String[] arguments) { Rectangle rect = new Rectangle(); rect.display(); rect.area(); } }OutputInside display Inside areaHere Rectangle class inherits Shape class and can execute two methods, display() and area() as shown.
Read MoreHow to reverse the elements of an array using stack in java?
Stack is an Abstract Data Type (ADT), commonly used in most programming languages. It is named stack as it behaves like a real-world stack, for example – a deck of cards or a pile of plates, etc.A stack is first in first out, it has two main operations push and pop. Push inserts data in to it and pop retrieves data from it.To reverse an array using stack initially push all elements in to the stack using the push() method then, retrieve them back using the pop() method into another array.Exampleimport java.util.Arrays; import java.util.Stack; public class ReversinArrayUsingStack { ...
Read More