Nancy Den has Published 330 Articles

Which equals operator (== vs ===) should be used in JavaScript?

Nancy Den

Nancy Den

Updated on 07-Jan-2020 10:59:49

81 Views

Double equals (==) is abstract equality comparison operator, which transforms the operands to the same type before making the comparison. For example, 5 ==  5       //true '5' == 5      //true 5 == '5'      //true 0 == false    //trueTriple equals (===) are strict equality ... Read More

Call event function from another method in Controller in SAP

Nancy Den

Nancy Den

Updated on 18-Dec-2019 10:02:35

468 Views

It is advised not to call the event function from any other function but what you can do is refactor the event function implementation in a separate function and call that from any other function as shown below:ExampleBtnPress: function(oEvent) {    // Separate the implementation in the helper function   ... Read More

Creating a table in SAP system using OData service

Nancy Den

Nancy Den

Updated on 18-Dec-2019 08:43:28

585 Views

In order to create a table, you need to use either *.hdbdd or *.hdbtable and then expose them with xsodata.You can check for more details:https://help.sap.com/viewer/52715f71adba4aaeb480d946c742d1f6/2.0.02/en-USExampleservice namespace "HANA.Tables" {    "Schema_Name"."PAKAGE::TABLENAME" as "NAMESPACE"; }

Naming conflict error while consuming SAP Web Service in .net

Nancy Den

Nancy Den

Updated on 18-Dec-2019 07:54:39

144 Views

You can fix this issue by adding Global before all calls giving the error. This has happened cos of system namespace in BAPI and Windows.ExampleAnother possible solution of this is by adding an alias for System.XML and change System.XML with SysXml as below:using SysXml = System.Xml; /// [System.Xml.Serialization.XmlElementAttribute(Form=SysXml.Schema.XmlSchemaForm.Unqualified)] ... Read More

Getting day of the year from DD/MM/YYYY using function in SAP system

Nancy Den

Nancy Den

Updated on 18-Dec-2019 07:49:03

439 Views

You can do this by following line of code:DATA(l_day) = m_date - CONV d(m_date(4) && '0101' ) + 1.Where m date is the date that needs to be input as type d. Note the format of type d is YYYYMMDD.ExampleIf the above function is not present in your system, you ... Read More

How to define methods for an Object in JavaScript?

Nancy Den

Nancy Den

Updated on 03-Oct-2019 08:07:09

83 Views

Methods are the functions that let the object do something or let something is done to it. There is a small difference between a function and a method – at a function is a standalone unit of statements and a method is attached to an object and can be referenced ... Read More

How to convert File into a Stream in Java?

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:26

547 Views

Let’s say we have a file “input.txt” here in the directory E:/ with the following content:Open a file with Bufferedreader. We have taken the above file here which is located at E: directory;BufferedReader buffReader = Files.newBufferedReader(Paths.get("E:\input.txt"), StandardCharsets.UTF_8);Now get the stream of lines from the above file and display:buffReader.lines().forEach(System.out::println);The following is ... Read More

Java Program to convert integer to String with Map

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:26

479 Views

Let’s say we have an Integer array with the following elements:20, 50, 100, 200, 250, 300, 500, 550, 600, 700Convert it to List:Arrays.asList(20, 50, 100, 200, 250, 300, 500, 550, 600, 700)Use Map to get the values greater than 400 and convert to String:filter(val -> val > 400) .map(val -> ... Read More

Java Program to check if none of the string in the list matches the condition

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:26

594 Views

First, create a List with String elements:List myList = new ArrayList(); myList.add("pqr"); myList.add("stu"); myList.add("vwx"); myList.add("yza"); myList.add("bcd"); myList.add("efg"); myList.add("vwxy");Use the noneMatch() method to check if none of the above string in the myList begins with a specific letter:myList.stream().noneMatch((a) -> a.startsWith("f"));TRUE is returned if none of the string begins with the specific ... Read More

How to change JLabel background and foreground color in Java?

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:26

3K+ Views

To change the JLabel foreground and background color, use the following methods:JLabel label; label.setForeground(new Color(120, 90, 40)); label.setBackground(new Color(100, 20, 70));The following is an example to change JLabel background and foreground color:Exampleimport java.awt.Color; import java.awt.Font; import javax.swing.*; import javax.swing.border.Border; public class SwingDemo {    public static void main(String args[]) { ... Read More

Advertisements