Nancy Den has Published 290 Articles

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

Nancy Den

Nancy Den

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

163 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

651 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

806 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

199 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

638 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

172 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

731 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

How to change JLabel background and foreground color in Java?

Nancy Den

Nancy Den

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

4K+ 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

How to right align the text in a ComboBox in Java

Nancy Den

Nancy Den

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

444 Views

To right align the text in a JComboBox, use the following:ComponentOrientation.RIGHT_TO_LEFTThe following is an example to right align the text in a ComboBox:Exampleimport java.awt.Component; import java.awt.ComponentOrientation; import javax.swing.DefaultListCellRenderer; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JList; public class SwingDemo extends JFrame {    public SwingDemo() {       JComboBox combo = ... Read More

How to set tooltip text for JCheckBox in Java?

Nancy Den

Nancy Den

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

431 Views

For JCheckBox, use the following to set tooltip text:checkBox1.setToolTipText("Sports Football"); checkBox2.setToolTipText("Sports Tennis");Tooltip text is visible whenever you will place cursor on that particular text.The following is an example. Here, we have set the tooltip text for both the sports:Exampleimport java.awt.*; import java.awt.event.*; import javax.swing.*; public class SwingDemo {    private ... Read More

Advertisements