Smita Kapse has Published 558 Articles

How to create a table in JavaDB using JDBC?

Smita Kapse

Smita Kapse

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

134 Views

You can create a table in JavaDB database using the CREATE TABLE statement.SyntaxCREATE TABLE table_name (    column_name1 column_data_type1 constraint (optional),    column_name2 column_data_type2 constraint (optional),    column_name3 column_data_type3 constraint (optional) );To create a table in JavaDB using JDBC API you need to −Register the driver − The forName() method ... Read More

Java Program to set JTextArea to wrap by word in Java

Smita Kapse

Smita Kapse

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

493 Views

To set JTextAream to wrap by word, you need to use the setWrapStyleWord(). Let’s say we have created a new JTextArea and set demo text −JTextArea textArea = new JTextArea("This is a text displayed for our example. More content is added in it now. More content is added in it ... Read More

Do MySQL Can Enum type values contain spaces in it?

Smita Kapse

Smita Kapse

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

342 Views

Yes, you can include a string value with spaces in ENUM type. Let us first create a table −mysql> create table DemoTable    (    Size ENUM('SMALL SIZE', 'LARGE SIZE', 'XL SIZE')    ); Query OK, 0 rows affected (0.65 sec)Let us check the description of table using DESC command ... Read More

How to detect user inactivity for 5 seconds in iOS?

Smita Kapse

Smita Kapse

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

949 Views

While designing any iOS Application you might come across a scenario where you have to do some sort of action if the screen is inactive for some amount of time.Here we will be seeing the same, we will be detecting user inactivity for 5 seconds.We will be using Apple’s UITapGestureRecognizer ... Read More

How to set default background color for JTextPane in Java?

Smita Kapse

Smita Kapse

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

652 Views

To set the default background color of JTextPane, use the SimpleAttributeSet and StyleConstants class. 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.setBackground(attributeSet, Color.white);Now, apply the set to the pane −pane.setCharacterAttributes(attributeSet, true);The following ... Read More

What is to be done when MongoDB takes too much time to find the record?

Smita Kapse

Smita Kapse

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

71 Views

To reduce the time to find record in MongoDB, you can use index. Following is the syntax −db.yourCollectionName.createIndex({yourFieldName:1});You can follow the below approaches to create index for field names based on number, text, hash, etc.First ApproachLet us create an index. Following is the query −> db.takeLessTimeToSearchDemo.createIndex({"EmployeeName":1}); {    "createdCollectionAutomatically" : ... Read More

How to get the possible values for SET field in MySQL?

Smita Kapse

Smita Kapse

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

266 Views

To get possible values for set field, you can use below syntax −desc yourTableName yourSetColumnName;Let us first create a table −mysql> create table DemoTable    (    Game set('Chess', 'Pig Dice', '29 Card')    ); Query OK, 0 rows affected (0.60 sec)Following is the query to get available values for ... Read More

Create circular Progress Bar in iOS

Smita Kapse

Smita Kapse

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

2K+ Views

It is very important to know how to create a circular progress bar for iOS developers, almost every application have this.This is mainly used in showing the downloading status, loading status or any other progress related thing.Creating Circular Progress bar may become very tedious for new programmers and they might ... Read More

How to use JTextPane to style code in Java?

Smita Kapse

Smita Kapse

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

408 Views

To style code in a TextPane component use the setText() for text and work with HTML tags. For code, use the tag. Also, do not forget to set the content type to “text/html” −JTextPane pane = new JTextPane(); pane.setContentType("text/html");If you won’t set the content type, then the output will ... Read More

How to return documents of a collection without objectId in MongoDB?

Smita Kapse

Smita Kapse

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

2K+ Views

To return documents of a collection without objectId, set _id:0. Let us first create a collection with documents −> db.returnDocumentWithoutObjectId.insertOne({"Name":"Carol", "Age":25}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ce8ba6c78f00858fb12e8fa") } > db.returnDocumentWithoutObjectId.insertOne({"Name":"Sam", "Age":21}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ce8ba6d78f00858fb12e8fb") } > db.returnDocumentWithoutObjectId.insertOne({"Name":"John", "Age":23}); {    "acknowledged" ... Read More

Advertisements