In general, while reading or writing data to a file, you can do so, from the start of the file. You cannot read/write from random position. The java.io.RandomAccessFile class in Java enables you to read/write data to a random-access file. This acts similar to a large array of bytes where the cursor known as file pointer works like an index. With the help of file pointer you can get the position of this pointer using the getFilePointer() method and set it using the seek() method. RandomAccessFile Class: Reading Files This class provides various methods to read and write data ... Read More
The term "Quick Commerce", describes extremely fast distribution services that guarantee distribution of goods of 10 to 30 minutes, usually grocery articles, everyday requirements and small electronics. With speed, convenience and immediate customer requirements, the next step in the development of e-commerce symbolizes. To continue this change, industries such as Blinkit, Zepto and Swiggy Instamart, are changing how consumers act and see what they demand from retailers.How Quick Commerce Is Changing the Retail Industry?Changing Expectations of Consumers: Nowadays, speed is a key distinction. Customers no longer wait for delivery for days or hours, they now want them in minutes.Growth of ... Read More
Python's built-in splitlines() method and the split() method with as a delimiter are sufficient to split strings based on newline characters. This article will explore different approaches to splitting strings on sequences of newline characters using Python's regular expressions. Splitting on One or More Newlines The Python re.split() function uses a regular expression to split a string. We'll use the pattern +, which means one or more newlines. The re.split() will find where these newlines are, split the string there, and return a list of the resulting pieces. The re.split() function then splits the string at each ... Read More
To find all matches to a regular expression in Python, you can use the re module, which provides regular expression matching operations. Here are a few methods to find all matches to regular expressions. Using re.findall(pattern, string) Using re.finditer(pattern, string) re.compile combined with findall or finditer Using re.findall(pattern, string) The re.findall() method finds all non-overlapping matches of the pattern in the string and returns them as a list of strings. This method returns a list of strings. If the pattern contains capturing groups, it returns ... Read More
In this article, we will demonstrate how to append one tuple to another in Python. Below are various methods to achieve this task - Using + operator. Using sum() function. Using list() & extend() functions. ... Read More
In Python, the XOR operator is one of the bitwise operators and is represented by the caret symbol ^. It returns 0 if both operands are the same and 1 if the operands are different. Truth Table of XOR The following is the truth table of the XOR (exclusive OR) operator - A B ... Read More
The Python ternary operator returns a value based on whether a condition is True or False. It is similar to an if-else statement but is expressed in a single line. For understanding the ternary operator, we need to have an idea about conditional statements. Let's have a basic understanding of the if-else statement. We will have an if block followed by an else block here. The if block is executed when the given condition is True, and the else block is executed if the given condition is False. The following is the basic syntax of the if-else statement - if condition: ... Read More
In this article, we will discuss how to extract all the integers from a string using C++ program. We will explore all the possible approaches to do so. First of all, let's understand the problem statement. We have a string that contains a mix of digits and non-digits. We need to extract all the integers from the string and store them in a vector. The integers can be positive or negative. For example, // Input String string str = "ab24wj-123fow" // Output Vector vector vec = {24, -123} Approaches to Extract Integers from String ... Read More
The given task is to write a Java program to check whether a string is a pangram or not. A string is called a pangram if and only if it contains all the letters of the English alphabet, regardless of their case. Example Scenario:Let's understand the problem with an example - Input: "The quick brown fox jumps over the lazy dog" Output: Yes, the string is a pangram Read the input String, you can find all the letters of the English alphabet in it. Therefore, it is a pangram string. How to Check if a String is a Pangram ... Read More
Java is a programming language that follows the Object-Oriented Programming paradigm. One of the pillars of OOPs is Inheritance, where you can find a relationship between two classes as Parent and Child. This relationship allows these classes to reuse each other's attributes and methods. Java classes can relate to each other in many ways such as, Is-A relationship and Has-A relationship. In this article, we are going to learn the concept of Has-A relationship in Java through examples. HAS-A Relationship in Java Has-A relationship is a type of association where two classes are linked to each other through objects. Here, ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP