Smita Kapse has Published 558 Articles

Set the content of the label horizontally and vertically centered in Java

Smita Kapse

Smita Kapse

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

213 Views

To simply set the content of the label horizontally and vertically centered, use the constant CENTER.JLabel label = new JLabel("Best IDE", JLabel.CENTER);The following is an example to set the content of the lable horizontally and verticaly centered −Examplepackage my; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import javax.swing.JFrame; import ... Read More

Lexicographically next permutation in C++

Smita Kapse

Smita Kapse

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

2K+ Views

Here we will see how to generate lexicographically next permutation of a string in C++. The lexicographically next permutation is basically the greater permutation. For example, the next of “ACB” will be “BAC”. In some cases, the lexicographically next permutation is not present, like “BBB” or “DCBA” etc.In C++ we ... Read More

MongoDB query where all array items are less than a specified condition?

Smita Kapse

Smita Kapse

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

170 Views

Let us first create a collection with documents −> db.arrayElementsNotGreaterThanDemo.insertOne({"Scores":[89, 43, 32, 45]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd9e9f9b50a6c6dd317adb3") } > db.arrayElementsNotGreaterThanDemo.insertOne({"Scores":[32, 33, 34, 40]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd9ea13b50a6c6dd317adb4") } > db.arrayElementsNotGreaterThanDemo.insertOne({"Scores":[45, 56, 66, 69]}); {    "acknowledged" : true,    "insertedId" ... Read More

Is it safe to delete a void pointer in C/C++?

Smita Kapse

Smita Kapse

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

887 Views

Void pointer is a pointer which is not associate with any data types. It points to some data location in storage means points to the address of variables. It is also called general purpose pointer.It is not safe to delete a void pointer in C/C++ because delete needs to call ... Read More

C++ Program to Find number of Ways to Partition a word such that each word is a Palindrome

Smita Kapse

Smita Kapse

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

138 Views

Here we shall discuss a C++ Program to find number of ways to Partition a word in such a way that each word is a Palindrome.AlgorithmsBegin    Take the word as input.    Function partitionadd(vector &u, string &s, vector &tmp, int index):    if (index == 0)       ... Read More

How to do alphanumeric sort in MongoDB?

Smita Kapse

Smita Kapse

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

437 Views

You need to set numericOrdering: true for alphanumeric sort. Let us first create a collection with documents −> db.alphanumericSortDemo.insertOne({"StudentId":"STU1010"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ccf149adceb9a92e6aa194c") } > db.alphanumericSortDemo.insertOne({"StudentId":"STU1101"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ccf14a2dceb9a92e6aa194d") } > db.alphanumericSortDemo.insertOne({"StudentId":"STU1901"}); {    "acknowledged" : true,    "insertedId" ... Read More

How to perform intersection of sets between the documents in a single collection in MongoDB?

Smita Kapse

Smita Kapse

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

101 Views

You can use $setIntersection for this. Let us first create a collection with documents −> db.setInterSectionDemo.insertOne( ...    {"_id":101, "Value1":[55, 67, 89]} ... ); { "acknowledged" : true, "insertedId" : 101 } > db.setInterSectionDemo.insertOne( ...    {"_id":102, "Value2":[90, 45, 55]} ... ); { "acknowledged" : true, "insertedId" : 102 } ... Read More

mbrtowc() function in C/C++

Smita Kapse

Smita Kapse

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

140 Views

This mbrtowc() function is used to convert multibyte sequence to wide character string. This returns the length of the multibyte characters in byte. The syntax is like below.mbrtowc (wchar_t* wc, const char* s, size_t max, mbstate_t* ps)The arguments are −wc is the pointer which points where the resulting wide character ... Read More

Search for documents matching first item in an array with MongoDB?

Smita Kapse

Smita Kapse

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

93 Views

Let us first create a collection with documents −> db.matchingFirstItemInTheArrayDemo.insertOne(    {       "ClientDetails": [          {             "ClientName": "Larry",             "ClientAge":28          }       ]    } ); { ... Read More

How to add button to notifications in android?

Smita Kapse

Smita Kapse

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

2K+ Views

This example demonstrate about How to add button to notifications in androidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 ... Read More

Advertisements