Chandu yadav has Published 1163 Articles

Retrieve from MySQL only if it contains two hyphen symbols?

Chandu yadav

Chandu yadav

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

451 Views

For this, use the LIKE operator. Let us first create a table:mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Password varchar(100)    ); Query OK, 0 rows affected (1.27 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Password) values('John@--123'); ... Read More

Can we display a JTabPane with TextArea in one of the tabs with Java

Chandu yadav

Chandu yadav

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

199 Views

Yes, we can display a JTabPane with TextArea in one of the tabs. For that, let us first create a JTabbedPane component −JTabbedPane tabbedPane = new JTabbedPane();Now, create a text area you want to set under one of the tabs −JTextArea text = new JTextArea(100, 100);Now, set panels for the ... Read More

When to use yield instead of return in Python?

Chandu yadav

Chandu yadav

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

880 Views

In short, whenever control reach the return statement in your program, the execution of the program is terminated and the remaining statements will not executed.However, in case of yield, whenever control reach the yield statement in your program, the execution of your program is paused and later we can continue ... Read More

HTML
    start Attribute

Chandu yadav

Chandu yadav

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

71 Views

The start attribute of the element is used to set the start value of the first list item.. Following is the syntax−Above, num is the number set for the start value of the first list item. Let us now see an example to implement the start attribute of the ... Read More

How to create Titled Border for a component in Java?

Chandu yadav

Chandu yadav

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

2K+ Views

To create a titled border for a component in Java, use the createTitledBorder() method. Let’s say we have a panel and we need to set a titled border to it. Here’s our panel −JPanel panel = new JPanel();Now, set the border and set the text for the tites border −panel.setBorder(BorderFactory.createTitledBorder( ... Read More

MySQL query to convert a string like “1h 15 min” into 75 minutes?

Chandu yadav

Chandu yadav

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

105 Views

You can use str_to_date() for this conversion. Let us first create a table −mysql> create table DemoTable    (    stringDate varchar(100)    ); Query OK, 0 rows affected (0.86 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('1h 15 min'); Query OK, 1 row ... Read More

Can we prevent the collapse of nodes and child nodes in a JTree with Java?

Chandu yadav

Chandu yadav

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

280 Views

Yes, we can prevent the collapse of nodes and child nodes in a JTree using setExpandedState() method. This method sets the expanded state of this JTree.If state istrue, all parents of path and path are marked asexpanded.The following is an example that prevents the collapse of nodes and child nodes ... Read More

Move the first row to the end of the JTable in Java Swing

Chandu yadav

Chandu yadav

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

442 Views

To move the first row to the end of the table in Java, use the moveRow() method. It has three parameters. The first two parameters allows you to set the starting and ending row index to be moved. The last parameter sets the destination of the rows to be moved.As ... Read More

Python program to Count words in a given string?

Chandu yadav

Chandu yadav

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

3K+ Views

Lets suppose we have a ‘string’ and the ‘word’ and we need to find the count of occurence of this word in our string using python. This is what we are going to do in this section, count the number of word in a given string and print it.Count the ... Read More

Java Program to deselect a range of columns in a JTable

Chandu yadav

Chandu yadav

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

78 Views

At first, let’s say, we have selected a range of columns using addColumnSelectionInterval() as shown in the demo screenshot −Now, we will deselect the above shown selected columns using removeColumnSelectionInterval(). The range is to be set here for interval i.e column 1 to 2 will get deselected −table.removeColumnSelectionInterval(1, 2);The following ... Read More

Advertisements