Karthikeya Boyini has Published 2383 Articles

Insertion in a MySQL table with only a single column set as auto_increment?

karthikeya Boyini

karthikeya Boyini

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

86 Views

Let us first create a table −mysql> create table DemoTable    -> (    -> StudentId int NOT NULL AUTO_INCREMENT,    -> PRIMARY KEY(StudentId)    -> ); Query OK, 0 rows affected (0.60 sec)Insert some records in the table using insert command. Here, we have inserted a value, but since ... Read More

What is Memory Leak in C/C++?

karthikeya Boyini

karthikeya Boyini

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

3K+ Views

The memory leak occurs, when a piece of memory which was previously allocated by the programmer. Then it is not deallocated properly by programmer. That memory is no longer in use by the program. So that place is reserved for no reason. That’s why this is called the memory leak.For ... Read More

Set Bounds for JProgressBar in Java Swing

karthikeya Boyini

karthikeya Boyini

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

228 Views

Use the setBounds() method to set Bounds for JProgressBar in Java Swing −JProgressBar progressBar; progressBar.setBounds(70, 50, 120, 30);The following is an example to set bounds for JProgressBar −Examplepackage my; import javax.swing.*; public class SwingDemo extends JFrame {    JProgressBar progressBar;    int i = 0;    SwingDemo() {     ... Read More

How will implement Your Own sizeof in C

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

To use the sizeof(), we can take the value using a variable x, using &x, it will print the address of it. Now if we increase the value of &x then it may increase in different way. If only one byte is increased, that means it is character, if the ... Read More

How can we set Mnemonic Key Radio Button in Java?

karthikeya Boyini

karthikeya Boyini

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

294 Views

Mnemonic key is set so that a user can use Keyboard keys to select a Radio Button. For example, a key can be set with ALT −radio2.setMnemonic(KeyEvent.VK_R);Above, we have set key ALT+R for radio2.The following is an example to set Mnemonic key radio button −package my; import java.awt.FlowLayout; import java.awt.event.KeyEvent; ... Read More

Can we skip a column name while inserting values in MySQL?

karthikeya Boyini

karthikeya Boyini

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

631 Views

Yes, we can do that. Let us first create a table −mysql> create table DemoTable    -> (    -> StudentName varchar(100),    -> StudentAge int    -> ); Query OK, 0 rows affected (0.72 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentAge) values(23); Query ... Read More

Java Program to display Frame after some seconds

karthikeya Boyini

karthikeya Boyini

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

281 Views

Use Timer() to set seconds for delay i.e. to display frame after a few seconds −Timer tm = new Timer(2000, new ActionListener() {    // }The following is an example to display Frame after some seconds −package my; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.Timer; public class SwingDemo extends ... Read More

How to correctly use INSERT INTO … SELECT in MySQL to avoid Error 1064?

karthikeya Boyini

karthikeya Boyini

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

515 Views

Let us first create a table −mysql> create table DemoTable1    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> FirstName varchar(100)    -> ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1(FirstName) values('John'); Query ... Read More

How can we grant a user to access all stored procedures in MySQL?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

Let us first display all users and host from the table MySQL.user −mysql> select user, host from Mysql.user;This will produce the following output −+------------------+-----------+ | user             | host      | +------------------+-----------+ | Bob              | %   ... Read More

Print a long int in C using putchar() only

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

Here we will see how to print long int value using the putchar() function in C. We can easily print the value of some variables using printf() in C, but here the restriction is, we cannot use any other function except putchar().As we know that the putchar() is used to ... Read More

Advertisements