guru

guru

8 Articles Published

Articles by guru

8 articles

How do I get a platform-independent new line character?

guru
guru
Updated on 01-Sep-2025 701 Views

When working with text in Java we often need to include new line characters to the format output properly. Different operating systems have different conventions for new line characters: Windows: This uses \r (Carriage Return + Line Feed). Unix/Linux: This uses (Line Feed). Mac (pre-OS X): This uses \r (Carriage Return). To write code that works seamlessly across all platforms and we need to use a platform-independent way of handling new line characters. This article will guide us through the different methods available in the Java to achieve this. Using Platform-Independent New Line Characters The recommended way ...

Read More

How to Write a SQL Query For a Specific Date Range and Date Time?

SQL
guru
guru
Updated on 27-Jan-2025 510 Views

Filtering data by date or datetime is a common requirement when working with SQL queries. Whether you're retrieving records for a specific date, a range of dates or precise timestamps SQL provides robust tools to handle such scenarios. Understanding Date and DateTime Data Types The SQL databases support various data types for storing the date and time information: DATE: Stores only the date (e.g. 2025-01-07). DATETIME: The Stores both date and time (e.g. 2025-01-07 14:30:00). TIMESTAMP: The Stores date and time with time zone information in some ...

Read More

Joining three or more tables in SQL

SQL
guru
guru
Updated on 27-Jan-2025 335 Views

In SQL, joining tables is an essential operation that combines data from multiple sources. While joining two tables is straightforward many real-world scenarios require joining three or more tables to retrieve comprehensive information. This article explains how to join three or more tables, complete with examples. Understanding Joins SQL joins are used to combine rows from two or more tables based on a related column. The Common types of joins include: INNER JOIN: Returns records that have matching values in both tables. ...

Read More

Setting up Sublime Text for C++ Competitive Programming Environment

C++
guru
guru
Updated on 20-Jan-2025 541 Views

The Sublime Text is a popular code editor due to its simplicity, speed and extensibility. While it may not have built-in C++ support, it's very easy to set up Sublime Text for competitive programming in C++. This guide will walk you through configuring Sublime Text to provide a smooth and efficient environment for C++ competitive programming. Steps to Set Up Sublime Text for C++ Competitive Programming 1. Install Sublime TextFirst, we need to install Sublime Text if you haven't already. Go to the Sublime Text website. Download and install the ...

Read More

How can I pass a parameter to a Java Thread?

guru
guru
Updated on 16-Jan-2025 719 Views

The Java threads provide a mechanism for the concurrent execution making it easier to perform the tasks in parallel. Often, we may need to pass parameters to a thread to ensure it operates with the specific input data. This article offers several practical approaches to passing parameters to a Java thread. Also read: How to create a Java Thread? Passing a Parameter to a Java Thread There can be multiple ways to pass a parameter to a Java thread; here are some of the ways you can use: Using a Custom Runnable Implementation ...

Read More

How to Get the names of the table in SQL

SQL
guru
guru
Updated on 01-Nov-2024 380 Views

In SQL databases, it is often necessary to retrieve the list of table names within a database to understand the structure or to perform the certain operations. Each SQL-based database system offers specific ways to query its metadata to extract the table names. In this article, we will explore how to get the names of tables in popular relational database systems including the MySQL, SQL Server, PostgreSQL and Oracle. We will cover the built-in SQL queries and functions that are commonly used for this task. Need to Retrieve Table Names? Database Exploration: When working with ...

Read More

SQL Query to Convert VARCHAR to INT

SQL
guru
guru
Updated on 25-Oct-2024 2K+ Views

In SQL, it is common to store data in different formats like VARCHAR, INT, FLOAT, etc. based on the needs of the application. However, sometimes we may need to convert a VARCHAR column to an INT for performing arithmetic operations, comparisons or other logical queries that require integer values. This article will explore various ways to convert VARCHAR (string) data types to INT in SQL using the built-in functions the potential pitfalls and examples. Why Convert VARCHAR to INT? While working with databases we may need to convert VARCHAR to INT in the following scenarios − ...

Read More

Difference between Stack and Tree

guru
guru
Updated on 24-Oct-2024 412 Views

The data structures are essential components in computer science and software engineering. Among the most commonly used are stacks and trees both of which play a crucial role in the different algorithms and systems. Though both stack and tree are non-primitive data structures they serve different purposes and operate on distinct principles. This article will explore the key differences between the stack and a tree, their structures, operations, use cases and examples. What is a Stack? A stack is a linear data structure that follows the Last In, First Out (LIFO) principle. This means that the last element added to ...

Read More
Showing 1–8 of 8 articles
« Prev 1 Next »
Advertisements