Nishtha Thakur has Published 564 Articles

Implement GREATEST() in MySQL and update the table?

Nishtha Thakur

Nishtha Thakur

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

111 Views

Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Number int ); Query OK, 0 rows affected (0.64 sec)Insert some records in the table using insert command −mysql> insert ... Read More

How to search for string or number in a field with MongoDB?

Nishtha Thakur

Nishtha Thakur

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

794 Views

You can use $in operator for this. Let us first create a collection with documents −> db.searchForStringOrNumberDemo.insertOne(    {       "_id": new ObjectId(),       "StudentName": "Larry",       "StudentDetails": {          "StudentMarks": {             "StudentMongoDBMarks": [44]   ... Read More

How to drop a table from JavaDB using JDBC?

Nishtha Thakur

Nishtha Thakur

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

114 Views

You can create a table in a database using the CREATE TABLE query.SyntaxCREATE TABLE table_name( column1 datatype, column2 datatype, column3 datatype, ..... columnN datatype, PRIMARY KEY( one or more columns ) );To create a table in a database using JDBC API you need to −Register the driver − Register the ... Read More

Java Program to format text in JTextPane

Nishtha Thakur

Nishtha Thakur

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

313 Views

To format text in JTextPane, use the SimpleAttributeSet and StyleConstants class. This allows you to set the style of text, background color, foreground color, etc.At first, create a new JTextPane −JTextPane pane = new JTextPane();Now, use the classes to set the style and color −SimpleAttributeSet attributeSet = new SimpleAttributeSet(); StyleConstants.setItalic(attributeSet, ... Read More

Set a specific Date Format in MySQL?

Nishtha Thakur

Nishtha Thakur

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

109 Views

To set a pecific date format, you need to use DATE_FORMAT() in MySQL. Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, ArrivalDate date ); Query OK, 0 rows ... Read More

How to check notifications status for the iOS App

Nishtha Thakur

Nishtha Thakur

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

2K+ Views

Notifications communicate important information to users of your app, regardless of whether your app is running on the user's device.For example, a sports app can let the user know when their favourite team scores. Notifications can also tell your app to download information and update its interface. Notifications can display ... Read More

How to set style for JTextPane in Java?

Nishtha Thakur

Nishtha Thakur

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

709 Views

To set style for text in JTextPane, use setItalic() or setBold() that sets italic or bold style for font respectively.Following is our JTextPane component −JTextPane pane = new JTextPane();Now, use the StyleConstants class to set style for the JTextPane we created above. We have also set the background and foregound ... Read More

How to update _id field in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

248 Views

You can’t directly update _id field i.e. write some script to update. Let us first create a collection with documents −> db.updatingIdFieldDemo.insertOne({"StudentName":"Chris"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ce271bb36e8b255a5eee949") }Following is the query to display all documents from a collection with the help of find() method −> db.updatingIdFieldDemo.find();This ... Read More

Insert multiple sets of values in a single statement with MySQL?

Nishtha Thakur

Nishtha Thakur

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

225 Views

Let us first create a table −mysql> create table DemoTable ( UserId int, UserName varchar(20), UserAge int ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command −mysql> insert ... Read More

I want to highlight all the text in the Java Swing Control Text Pane

Nishtha Thakur

Nishtha Thakur

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

190 Views

To highlight all the text, use the selectAll() method of the JTextPane component −JTextPane pane = new JTextPane(); pane.selectAll();The following is an example to highlight the JTextPane text. Here, we are displaying a code in the JTextPane and highlighting it −Examplepackage my; import java.awt.BorderLayout; import java.awt.Container; import javax.swing.JFrame; import javax.swing.JScrollPane; ... Read More

Advertisements