vanithasree

vanithasree

57 Articles Published

Articles by vanithasree

Page 4 of 6

how to shuffle a 2D array in java correctly?

vanithasree
vanithasree
Updated on 24-Feb-2020 2K+ Views

Yes. Create a list to represent a 2D array and then use Collections.shuffle(list).Exampleimport java.util.ArrayList; import java.util.Collections; import java.util.List; public class Tester {    public static void main(String[] args) {       List rows = new ArrayList();       rows.add(new int[]{1,2,3});       rows.add(new int[]{4,5,6});       rows.add(new int[]{7,8,9});       System.out.println("Before Shuffle");       System.out.println("[0][0] : " + rows.get(0)[0]);       System.out.println("[1][1] : " + rows.get(1)[1]);       System.out.println("After Shuffle");       Collections.shuffle(rows);       System.out.println("[0][0] : " + rows.get(0)[0]);       System.out.println("[1][1] : " + rows.get(1)[1]);    } }OutputBefore Shuffle [0][0] : 1 [1][1] : 5 After Shuffle [0][0] : 7 [1][1] : 2

Read More

What is a Java class library?

vanithasree
vanithasree
Updated on 18-Feb-2020 1K+ Views

Java is not dependent on any specific operating system so Java applications cannot depend on the platform dependent native libraries, therefore, instead of those Java provides a set of dynamically loaded libraries that are common to modern operating systems.These libraries provide –Container classes and Regular Expressions.Interfaces for tasks that depend on the hardware of the OS such as network and file access.In case, the underlying platform does not support certain feature of Java then, these libraries surpass that specific feature if needed.

Read More

Taking schema wise backup in SAP HANA

vanithasree
vanithasree
Updated on 14-Feb-2020 621 Views

Data backup in any RDBMS system comes under Data Persistence layer. SAP HANA holds the bulk of its data in memory for maximum performance, but it still uses persistent storage to provide a fallback in case of failure.When you refer a schema in database, it refers to a namespace in the database. It is not possible to take backup schema wise as you do for complete database.However it is possible to export a schema using below command −EXPORT "MY_SCHEMA".* AS BINARY INTO '/tmp/my_schema' WITH REPLACE;SyntaxEXPORT AS INTO [WITH ] [ ]Note that you shouldn’t take schema ...

Read More

Analogous to IN operator of SQL in SAP

vanithasree
vanithasree
Updated on 13-Feb-2020 178 Views

You can get similar things done in many ways. You can use an internal table usage or a range table.Let me showcase an example with an internal table for your reference.SELECT Id, Name, DOB FROM sEmployee INTO CORRESPONDING FIELDS OF TABLE result_tab FOR ALL ENTRIES IN internal_tab // internal_tab is an internal table defined with columns WHERE Id = internal_tab -Id AND Name = internal_tab –Name

Read More

How can we write MySQL handler, in a stored procedure, that throws an error message and continues the execution?

vanithasree
vanithasree
Updated on 12-Feb-2020 882 Views

As we know that whenever an exception occurred in MySQL stored procedure, it is very important to handle it by throwing proper error message because if we do not handle the exception, there would be a chance to fail application with that certain exception in a stored procedure. MySQL provides a handler that throws an error message and continues the execution. To demonstrate it, we are using the following example in which we are trying to insert a duplicate value in a Primary key column.Examplemysql> DELIMITER // mysql> Create Procedure Insert_Studentdetails(S_Studentid INT, S_StudentName Varchar(20), S_Address Varchar(20))    -> BEGIN   ...

Read More

How can we get an idea about the server performance from the output of MySQL?

vanithasree
vanithasree
Updated on 11-Feb-2020 131 Views

After running a query, MySQL returns the number of rows and gives time in the output that shows how much it took for running that query. As for example, if we run the following querymysql> create table e1(id int); Query OK, 0 rows affected (0.23 sec)It is showing the time (0.23 sec).

Read More

How to set the whitespace between text in CSS?

vanithasree
vanithasree
Updated on 31-Jan-2020 263 Views

To set the whitespace between text, use the white-space property. Possible values are normal, pre, nowrap.ExampleYou can try to run the following code to set the whitespace between text in CSS:                            This text has a line break and the white-space pre setting tells the browser to honor          it just like the HTML pre tag.    

Read More

Set the font family with CSS

vanithasree
vanithasree
Updated on 30-Jan-2020 463 Views

The font-family property is used to change the face of a font. Possible value could be any font family name.                            This text is rendered in either georgia, garamond, or the default serif font          depending on which font you have at your system.          

Read More

With the help of function, how can we return the difference in Year, Month and Days between two date values?

vanithasree
vanithasree
Updated on 29-Jan-2020 142 Views

We can create a function, which accepts the date values as its argument and returns the difference in year, month and days, as followsmysql> CREATE FUNCTION date_difference(Date1 DATE, date2 DATE) RETURNS VARCHAR(30)    -> RETURN CONCAT(    -> @years := TIMESTAMPDIFF(YEAR, date1, date2), IF (@years = 1, ' year, ', ' years, '),    -> @months := TIMESTAMPDIFF(MONTH, DATE_ADD(date1, INTERVAL @years YEAR), date2), IF (@months = 1, ' month, ', ' months, '),    -> @days := TIMESTAMPDIFF(DAY, DATE_ADD(date1, INTERVAL @years * 12 + @months MONTH), date2), IF (@days = 1, ' day', ' days')) ;    Query OK, 0 ...

Read More

How does comparison operator work with date values in MySQL?

vanithasree
vanithasree
Updated on 28-Jan-2020 226 Views

Comparison operator between dates will work in a logical way. In the following example, while comparing two dates, MySQL is simply comparing two numbers or string −mysql> select 20171027 < 20150825; +---------------------------+ | 20171027 < 20150825       | +---------------------------+ |                      0    | +---------------------------+ 1 row in set (0.00 sec)The 0 output shows that the result of the above query is FALSE.mysql> select 20171027 > 20150825; +--------------------------+ | 20171027 > 20150825      | +--------------------------+ |                      1   | +--------------------------+ 1 row in set (0.00 sec)The output ‘1’ shows that the result of the above query is TRUE.

Read More
Showing 31–40 of 57 articles
Advertisements