Smita Kapse has Published 498 Articles

Display all deadlock logs in MySQL?

Smita Kapse

Smita Kapse

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

4K+ Views

First of all, you need to enable innodb_print_all_deadlocks. Following is the syntax −set global innodb_print_all_deadlocks=1;After executing the above statement, let us execute the below syntax in order to display all deadlock logs −show engine innodb status;Let us implement the above syntax −mysql> set global innodb_print_all_deadlocks=1; Query OK, 0 rows affected ... Read More

How to align multiple buttons with different height in Java?

Smita Kapse

Smita Kapse

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

559 Views

To align multiple buttons with different height in Java, try the following example, Here, we have set 5 buttons with GridBagConstraints −GridBagConstraints constraints = new GridBagConstraints(); constraints.insets = new Insets(5, 5, 5, 5); constraints.anchor = GridBagConstraints.WEST;In addition, to set different height for different buttons, we have used −component. getPreferredSize().heightThe following ... Read More

Select last 3 rows from database order by id ASC?

Smita Kapse

Smita Kapse

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

463 Views

You can use subquery. Following is the syntax −SELECT * FROM (    SELECT * FROM yourTableName ORDER BY yourIdColumnName DESC LIMIT 3 ) anyAliasName ORDER BY yourIdColumnName;Let us first create a table −mysql> create table DemoTable (    ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ClientName varchar(100) ); Query OK,  0 rows affected (0.60 sec)Insert some records in the table using insert command ... Read More

Matching an array field that contains any combination of the provided array in MongoDB?

Smita Kapse

Smita Kapse

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

244 Views

Use $nin operator along with $elemMatch and $not for this. To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.combinationOfArrayDemo.insertOne({"StudentName":"Larry", "StudentAge":21, "StudentFavouriteTechnicalSubject":["C", "Java"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c7f77cc8d10a061296a3c58") } > ... Read More

What is the addAtX() method of the Ennead Tuple in Java

Smita Kapse

Smita Kapse

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

118 Views

To add value in Ennead class in JavaTuples, you need to use the addAtX() method. Here, X represents the index wherein you need to add the value i.e. for index 2, use addAt2() method. Add the specific value as the parameter value of the method. For example −addAt2(“John”);Let us first ... Read More

Is it possible to use variable for collection name using PyMongo?

Smita Kapse

Smita Kapse

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

681 Views

PyMongo is a Python distribution containing tools for working with MongoDB. Use the following syntax to use a variable for collection name −var yourVariableName="yourCollectionName"; db[storeCollectionName].yourOperationName;To understand the above syntax, let us create a collection with the document. The query to create a collection with a document is as follows. ... Read More

How to count number of distinct values per field/ key in MongoDB?

Smita Kapse

Smita Kapse

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

543 Views

You can use the distinct command for this. To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.distinctCountValuesDemo.insertOne({"StudentFirstName":"John", "StudentFavouriteSubject":["C", "C++", "Java", "MySQL", "C", "C++"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c8a39f193b406bd3df60e07") } ... Read More

How to filter data using where Clause and “LIKE” in Android sqlite?

Smita Kapse

Smita Kapse

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

745 Views

Before getting into example, we should know what sqlite data base in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to ... Read More

How to create LabelValue Tuple from an array in Java

Smita Kapse

Smita Kapse

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

133 Views

To create LabelValue tuple from an array, use the fromArray() method. First, create an array and add elements to it. After that, use the fromArray() method to create a Tuple and set the array in it.Let us first see what we need to work with JavaTuples. To work with LabelValue ... Read More

Removing _id element from PyMongo results?

Smita Kapse

Smita Kapse

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

636 Views

To remove the _id element, you can use the following syntax −db.yourCollectionName.find({}, {'_id': false}).pretty();To understand the above syntax, let us create a collection with the document. The query to create a collection with a document is as follows −> db.removingidElementDemo.insertOne({"UserName":"John", ... "UserAge":21}); {    "acknowledged" : true,    "insertedId" : ... Read More

Advertisements