Smita Kapse has Published 558 Articles

Get and Set the stack size of thread attribute in C

Smita Kapse

Smita Kapse

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

1K+ Views

To get and set the stack size of thread attribute in C, we use the following thread attributes:pthread_attr_getstacksize()Use for get threads stack size. The stacksize attribute gives the minimum stack size allocated to threads stack. In case of a successful run, then it gives 0 otherwise gives any value.It takes ... Read More

MySQL select only duplicate records from database and display the count as well?

Smita Kapse

Smita Kapse

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

319 Views

To select only duplicate records from database and display the count, use HAVING along with aggregate function count(). Let us first create a table −mysql> create table duplicateRecords    -> (    -> ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> ClientName varchar(20)    -> ); Query OK, 0 ... Read More

How to remove data from Linked hashset in Android?

Smita Kapse

Smita Kapse

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

65 Views

This example demonstrate about How to remove data from Linked hashset in AndroidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.       ... Read More

Can we GROUP BY one column and select all data in MySQL?

Smita Kapse

Smita Kapse

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

899 Views

Yes, you can use group_concat() for this. Let us first create a table −mysql> create table groupByOneSelectAll    -> (    -> StudentDetails varchar(100),    -> StudentName varchar(100)    -> ); Query OK, 0 rows affected (0.91 sec)Following is the query to insert some records in the table using insert ... Read More

Why does std::getline() skip input after a formatted extraction?

Smita Kapse

Smita Kapse

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

385 Views

The std::getline() skips input after some formatted extraction. We can simply check this error from the following code −Example Code#include #include using namespace std; int main(){    string name;    string city;    if (cin >> name && getline(cin, city)){       cout

How do you get assembler output from C/C++ source in gcc?

Smita Kapse

Smita Kapse

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

2K+ Views

Here we will see how to generate assembler output from C or C++ code using gcc.The gcc provides a great feature to get all intermediate outputs from a source code while executing. To get the assembler output we can use the option ‘-S’ for the gcc. This option shows the ... Read More

Insert current date to the database in MySQL?

Smita Kapse

Smita Kapse

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

4K+ Views

To insert current date to the database, you can use NOW(). Following is the syntax −INSERT INTO yourTableName(yourDateColumnName) VALUES(NOW());If your column has datatype date then NOW() function inserts only current date, not time and MySQL will give a warning. To remove the warning, you can use CURDATE().Let us first create ... Read More

Returning multiple values from a C++ function

Smita Kapse

Smita Kapse

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

9K+ Views

In C or C++, we cannot return multiple values from a function directly. In this section we will see how to use some trick to return more than one value from a function.We can return more than one values from a function by using the method called “call by address”, ... Read More

Why C++ does not have a virtual constructor?

Smita Kapse

Smita Kapse

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

3K+ Views

The virtual mechanism works only when we have a base class pointer to a derived class object.In C++, constructor cannot be virtual, because when constructor of a class is executed there is no virtual table in the memory, means no virtual pointer defined yet. So, the constructor should always be ... Read More

Select results from the middle of a sorted list in MySQL?

Smita Kapse

Smita Kapse

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

810 Views

To select results from the middle of a sorted list, use ORDER BY clause along with LIMIT.Let us first create a table. Following is the query −mysql> create table sortedListDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentName varchar(100)    -> ); Query ... Read More

Advertisements