Nishtha Thakur has Published 564 Articles

How to set Row Header View for JScrollPane in Java?

Nishtha Thakur

Nishtha Thakur

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

469 Views

Set Row Header View using the setRowHeaderView() method. Let us first create a KScrollPane and set a list −List myList = new ArrayList(10); for (int index = 0; index < 20; index++) {    myList.add("List Item " + index); } final JList list = new JList(myList.toArray(new String[myList.size()])); JScrollPane scrollPane = ... Read More

Difference between %p and %x in C/C++

Nishtha Thakur

Nishtha Thakur

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

9K+ Views

Here we will see what are the differences between %p and %x in C or C++. The %p is used to print the pointer value, and %x is used to print hexadecimal values. Though pointers can also be displayed using %u, or %x. If we want to print some value ... Read More

C++ Program to Implement Levenshtein Distance Computing Algorithm

Nishtha Thakur

Nishtha Thakur

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

3K+ Views

The Levenshtein distance between two strings means the minimum number of edits needed to transform one string into the other, with the edit operations i.e; insertion, deletion, or substitution of a single character.For example: The Levenshtein Distance between cat and mat is 1 −cat mat(substitution of ‘c’ with ‘m’)Here is a ... Read More

Are there benefits of passing by pointer over passing by reference in C++?

Nishtha Thakur

Nishtha Thakur

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

428 Views

A pointer can receive a null parameter whereas a reference can’t. You can only use pointer if you want to pass “no object”.Explicitly passing by pointer allow us to see the whether the object is passes by reference or value at call site.These are simple example of passing by pointer ... Read More

How to remove the notification after the particular time in android?

Nishtha Thakur

Nishtha Thakur

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

539 Views

This example demonstrate about How to remove the notification after the particular time 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.   ... Read More

C++ Program to Decode a Message Encoded Using Playfair Cipher

Nishtha Thakur

Nishtha Thakur

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

385 Views

In this scheme, pairs of letters are encrypted, instead of single letters as in the case of simple substitution cipher.In playfair cipher, initially a key table is created. The key table is a 5×5 grid of alphabets that acts as the key for encrypting the plaintext. Each of the 25 ... Read More

Update multiple rows in a single MongoDB query?

Nishtha Thakur

Nishtha Thakur

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

320 Views

Use the concept of initializeUnorderedBulkOp(). Let us first create a collection with documents −>db.upDateMultipleRowsDemo.insertOne({"CustomerName":"John", "CustomerPurchaseAmount":500}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6ceb06d78f205348bc626") } >db.upDateMultipleRowsDemo.insertOne({"CustomerName":"Chris", "CustomerPurchaseAmount":700}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6ceb26d78f205348bc627") } >db.upDateMultipleRowsDemo.insertOne({"CustomerName":"David", "CustomerPurchaseAmount":50}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6ceb36d78f205348bc628") } >db.upDateMultipleRowsDemo.insertOne({"CustomerName":"Larry", ... Read More

How to detect a new Android notification?

Nishtha Thakur

Nishtha Thakur

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

2K+ Views

This example demonstrate about How to detect a new Android notificationStep 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 src/MyListener.javapublic interface MyListener {    void setValue (String ... Read More

Set the alignment of the JLabel content along the X axis on the right in Java

Nishtha Thakur

Nishtha Thakur

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

142 Views

To set the alignment of the label’s content along the X axis on the right, use the setHorizontalAlignment() method and set the location. 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 ... Read More

How to compare pointers in C/C++?

Nishtha Thakur

Nishtha Thakur

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

7K+ Views

We can compare pointers if they are pointing to the same array. Relational pointers can be used to compare two pointers. Pointers can’t be multiplied or divided.In CExample Live Demo#include int main() {    int *p2;    int *p1;    p2 = (int *)300;    p1 = (int *)200;   ... Read More

Advertisements