Smita Kapse has Published 498 Articles

setjump() and longjump() in C

Smita Kapse

Smita Kapse

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

3K+ Views

In this section, we will see what are the setjump and longjump in C. The setjump() and longjump() is located at setjmp.h library. The syntax of these two functions is like below.setjump(jmp_buf buf) : uses buf to store current position and returns 0. longjump(jmp_buf buf, i) : Go back to ... Read More

How do I know which MongoDB version is installed using the Command Line?

Smita Kapse

Smita Kapse

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

12K+ Views

First open the CMD and then reach the BIN directory of MongoDB. The screenshot to open CMD prompt is as follows.Above we have reached the RUN dialog by pressing START and then typing RUN and ENTER.Now, type CMD and press OK button to get the command line. The screenshot is ... Read More

Comparison of Exception Handling in C++ and Java

Smita Kapse

Smita Kapse

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

289 Views

The exception handling feature is present almost any object oriented languages nowadays. In C++ and Java also we can get this kind of feature. There are some similarities between exception handling in C++ and exception handling in Java, like in both languages we have to use the try-catch block. Though ... Read More

How to create a JLabel with an image icon in Java?

Smita Kapse

Smita Kapse

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

6K+ Views

Let us create a label with image icon −JLabel label = new JLabel("SUBJECT "); label.setIcon(new ImageIcon("E:ew.png"));Now, create another component −JTextArea text = new JTextArea(); text.setText("Add subject here...");Align the components with GridBagLayout −panel.setLayout(new GridBagLayout());The following is an example to center a label with an image icon −Examplepackage my; import java.awt.GridBagLayout; import ... Read More

How to sum every field in a sub document of MongoDB?

Smita Kapse

Smita Kapse

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

414 Views

To sum every field in a sub document, use aggregate framework. Let us first create a collection with documents −> db.sumEveryFieldDemo.insertOne( ...    { ...       "_id":101, ...       "PlayerDetails": [ ...          {"PlayerName":"John", "PlayerScore":1000}, ...          {"PlayerName":"Carol", "PlayerScore":2000}, ...          {"PlayerName":"Sam", "PlayerScore":3000} ...    ... Read More

MongoDB to sort by subdocument match?

Smita Kapse

Smita Kapse

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

323 Views

To sort by sub-document match, you can use aggregate framework. Let us first create a collection with documents −> db.sortBySubDocumentsDemo.insertOne(    {       "StudentName": "Chris",       "StudentDetails": [          {             "Age":21,             ... Read More

How to set the alignment of the JLabel content along the Y axis in Java?

Smita Kapse

Smita Kapse

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

547 Views

To set the alignment of the label content along the Y axis, use the setVerticalAlignment() method. Let us first set a label component. We have set the label background color as well so that we can check the alignment of the label’s content properly −JLabel label = new JLabel("Product Name ... Read More

isnormal() in C++

Smita Kapse

Smita Kapse

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

122 Views

In this section we will see the isnormal() function in C++. This function is present in the cmath library. This function is used to check whether a number is normal or not. The numbers that are considered as non-normal are zeros, infinity or NAN.This function takes float, double or long ... Read More

ctime() Function in C/C++

Smita Kapse

Smita Kapse

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

455 Views

The C library function char *ctime(const time_t *timer) returns a string representing the localtime based on the argument timer.The returned string has the following format − Www Mmm dd hh:mm:ss yyyy, where Www is the weekday, Mmm the month in letters, dd the day of the month, hh:mm:ss the time, ... Read More

8086 program to determine subtraction of corresponding elements of two arrays

Smita Kapse

Smita Kapse

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

326 Views

In this program we will see how to subtract the contents of two different arrays.Problem StatementWrite 8086 Assembly language program to subtract the contents to corresponding elements which are stored in two different arraysDiscussionIn this example there are two different arrays. The arrays are stored at location 501 onwards and ... Read More

Advertisements