Samual Sam has Published 2492 Articles

Combining LIKE and CONTAINS operator in SAP HANA

Samual Sam

Samual Sam

Updated on 26-Feb-2020 06:11:45

575 Views

The code you are using \1+ just removes consecutive occurrences only. You can use the below code.SELECT REPLACE_REGEXPR('(.)(?=.*\1)' IN '22331122' WITH '' OCCURRENCE ALL)  FROM DUMMYThe output will come out to be “312”. This will remove all multiple occurrences and only last one will be kept.

What is the try block in Java?

Samual Sam

Samual Sam

Updated on 25-Feb-2020 10:44:22

413 Views

A try/catch block is placed around the code that might generate an exception. Code within a try/catch block is referred to as protected code, and the syntax for using try/catch looks like the following –Syntaxtry {    // Protected code } catch (ExceptionName e1) {    // Catch block }The ... Read More

What is the difference between Serialization and Deserialization in Java?

Samual Sam

Samual Sam

Updated on 25-Feb-2020 10:28:26

2K+ Views

Serialization Java provides a mechanism, called object serialization where an object can be represented as a sequence of bytes that includes the object's data as well as information about the object's type and the types of data stored in the object.Exampleimport java.io.*; public class SerializeDemo {    public static void ... Read More

How MySQL stored GENERATED COLUMNS can work with mathematical expressions?

Samual Sam

Samual Sam

Updated on 21-Feb-2020 12:20:32

71 Views

It can be illustrated with the help of an example in which we are creating a stored generated column in the table named ‘triangle_stored’. As we know that stored generated column can be generated by using the keyword ‘stored’.Examplemysql> Create table triangle_stored(SideA DOUBLE, SideB DOUBLE, SideC DOUBLE AS (SQRT(SideA * ... Read More

What does the method fill(int[], int val) do in java?

Samual Sam

Samual Sam

Updated on 20-Feb-2020 12:42:04

89 Views

The fill(int[] a, int val) method of the java.util.Arrays class assigns the specified int value to each element of the specified array of integers.Exampleimport java.util.Arrays; public class ArrayDemo {    public static void main(String[] args) {       int arr[] = new int[] {1, 6, 3, 2, 9}; ... Read More

What does the method hashCode(int[] a) do in java?

Samual Sam

Samual Sam

Updated on 20-Feb-2020 12:31:32

73 Views

The hashCode(int[]) method of the java.util.Arrays class returns a hash code based on the contents of the specified array. For any two non-null int arrays a and b such that Arrays.equals(a, b), it is also the case that Arrays.hashCode(a) == Arrays.hashCode(b).Exampleimport java.util.Arrays; public class ArrayDemo {    public static void main(String[] ... Read More

How to open a plain text file in Java?

Samual Sam

Samual Sam

Updated on 20-Feb-2020 09:54:30

239 Views

You can access a plain text using the File class.ExampleLive Demoimport java.io.File; public class ReadFile {    public static void main(String[] args) {       File f = null;       String str = "data.txt";       try {          f = ... Read More

How to create a Directory recursively using Java?

Samual Sam

Samual Sam

Updated on 20-Feb-2020 09:49:22

191 Views

The java.io.File.mkdirs() creates the directory named by this abstract pathname, together with necessary and non-existent parent directories.ExampleLive Demoimport java.io.File; public class Main {    public static void main(String[] args) {       String directories = "D:\a\b\c\d ";       File file = new File(directories);       boolean ... Read More

Can private methods of a class be accessed from outside of a class in Java?

Samual Sam

Samual Sam

Updated on 18-Feb-2020 09:45:41

14K+ Views

You can access the private methods of a class using java reflection package.Step1 − Instantiate the Method class of the java.lang.reflect package by passing the method name of the method which is declared private.Step2 − Set the method accessible by passing value true to the setAccessible() method.Step3 − Finally, invoke ... Read More

Getting unauthorized exception in SAP ABAP

Samual Sam

Samual Sam

Updated on 18-Feb-2020 06:48:31

131 Views

To fix this issue, you need to add try/catch response to the code. When you don’t include an authorization header, it results in an error 401 from the server.try {     CatalogService.CatalogChangeClient service =      new CatalogService.CatalogChangeClient();     service.ClientCredentials.UserName.UserName = "username";     service.ClientCredentials.UserName.Password = "password";   ... Read More

Advertisements