George John has Published 1081 Articles

Check existence of an element in Java ArrayList

George John

George John

Updated on 13-Sep-2023 13:15:56

34K+ Views

The java.util.ArrayList.contains() method can be used to check if an element exists in an ArrayList or not. This method has a single parameter i.e. the element whose presence in the ArrayList is tested. Also it returns true if the element is present in the ArrayList and false if the element ... Read More

Error-Detecting Codes - Checksums

George John

George John

Updated on 13-Sep-2023 13:08:01

48K+ Views

Errors and Error DetectionWhen bits are transmitted over the computer network, they are subject to get corrupted due to interference and network problems. The corrupted bits leads to spurious data being received by the receiver and are called errors.Error detection techniques are responsible for checking whether any error has occurred ... Read More

How to find the first character of a string in C#?

George John

George John

Updated on 10-Sep-2023 08:18:07

44K+ Views

To get the first character, use the substring() method.Let’s say the following is our string −string str = "Welcome to the Planet!";Now to get the first character, set the value 1 in the substring() method.string res = str.Substring(0, 1);Let us see the complete code −Example Live Demousing System; public class Demo ... Read More

How to cast from VARCHAR to INT in MySQL?

George John

George John

Updated on 07-Sep-2023 01:05:54

42K+ Views

To cast VARCHAR to INT, we can use the cast() function from MySQL. Here is the syntax of cast() function. cast(anyValue as dataType) For our example, we will create a table with the help of CREATE command. mysql> create table VarchartointDemo -> ( -> ... Read More

How do I check if a column is empty or null in MySQL?

George John

George John

Updated on 02-Sep-2023 15:49:47

48K+ Views

To check if a column is empty or null , we can use the WHERE clause with IS NULL and for empty we can use the condition ' ' i.e., empty space. The steps required for this are as folllows: First a table is created with the help of CREATE ... Read More

How to create a table with date column?

George John

George John

Updated on 02-Sep-2023 02:12:57

103K+ Views

To create a table with only date column, you can use DATE type. Let us first create a table −mysql> create table DemoTable    (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentName varchar(20),    StudentAdmissionDate DATE    ); Query OK, 0 rows affected (0.47 sec)Insert records in ... Read More

How to format number to 2 decimal places in MySQL?

George John

George John

Updated on 19-Mar-2023 12:06:46

4K+ Views

You can use TRUNCATE() function from MySQL to format number to 2 decimal places. The syntax is as follows −SELECT TRUNCATE(yourColumnName, 2) as anyVariableName from yourTableName;To understand the above syntax, let us first create a table. The query to create a table is as follows −mysql> create table FormatNumberTwoDecimalPlace   ... Read More

What is Java String literal?

George John

George John

Updated on 05-Sep-2022 11:34:39

4K+ Views

Strings, which are widely used in Java programming, are a sequence of characters. In Java programming language, strings are treated as objects. The Java platform provides the String class to create and manipulate strings. You can also create a String directly as − String greeting = "Hello world!"; A ... Read More

C++ Program to Compute the Area of a Triangle Using Determinants

George John

George John

Updated on 04-Jul-2020 14:33:05

679 Views

In this section we will see how to find the area of a triangle in 2D coordinate space using matrix determinants. In this case we are considering the space is 2D. So we are putting each points in the matrix. Putting x values at the first column, y into the ... Read More

Define colors using the Red-Green-Blue-Alpha model (RGBA) with CSS

George John

George John

Updated on 04-Jul-2020 06:59:05

194 Views

Use the CSS rgb() function to define color using the RGB Model.Use the CSS rgba() function to set RGB colors with opacity.ExampleYou can try to run the following code to set the color with rgba() functionLive Demo                    h1 { ... Read More

Advertisements