Nitya Raut has Published 272 Articles

How to use Singleton with Global Context in android?

Nitya Raut

Nitya Raut

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

691 Views

Before getting into example, we should know what singleton design patter is. A singleton is a design pattern that restricts the instantiation of a class to only one instance. Notable uses include controlling concurrency, and creating a central point of access for an application to access its data store.This example ... Read More

How to pass objects to functions in C++ Program?

Nitya Raut

Nitya Raut

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

8K+ Views

There are four ways of passing objects to functions. Let's assume you have a class X and want to pass it to a function fun, thenPass by ValueThis creates a shallow local copy of the object in the function scope. Things you modify here won't be reflected in the object ... Read More

How to remove an item from a C++ STL vector with a certain value?

Nitya Raut

Nitya Raut

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

581 Views

Erase function is used to remove an item from a C++ STL vector with a certain value.AlgorithmBegin Declare vector v and iterator it to the vector. Initialize the vector. Erase() function is used to remove item from end. Print the remaining elements. End.Example Code#include #include using namespace std; ... Read More

How to get the number of records in a table using JDBC?

Nitya Raut

Nitya Raut

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

356 Views

The ResultSet class doesn’t provide any direct method to get the number of records in a table.The beforeFirst() method navigates the pointer/curser of the ResultSet object to its default position before first.In the same way the last() method positions the cursor at the last row of the ResultSet object.Using these ... Read More

Difference between 'struct' and 'typedef struct' in C++ program?

Nitya Raut

Nitya Raut

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

5K+ Views

Basically struct is used to define a structure. But when we want to use it we have to use the struct keyword in C. If we use the typedef keyword, then a new name, we can use the struct by that name, without writing the struct keyword.In C++, there is ... Read More

Understanding Logistic Regression in Python?

Nitya Raut

Nitya Raut

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

258 Views

Logistic Regression is a statistical technique to predict the binary outcome. It’s not a new thing as it is currently being applied in areas ranging from finance to medicine to criminology and other social sciences.In this section we are going to develop logistic regression using python, though you can implement ... Read More

Is there a performance difference between i++ and ++i in C++?

Nitya Raut

Nitya Raut

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

747 Views

There is a big distinction between the suffix and prefix versions of ++.In the prefix version (i.e., ++i), the value of i is incremented, and the value of the expression is the new value of i. So basically it first increments then assigns a value to the expression.In the postfix ... Read More

C++ Program to Perform Edge Coloring to the Line Graph of an Input Graph

Nitya Raut

Nitya Raut

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

246 Views

The line graph of an undirected graph G is another graph L(G) that represents the adjacencies between edges of G. In this program, we Perform Edge Coloring to the Line Graph of an Input Graph.AlgorithmBegin    Take the input of the number of vertices ‘n’ and number of edges ‘e’. ... Read More

How to get the size of a column of a table using JDBC?

Nitya Raut

Nitya Raut

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

1K+ Views

You can get the size of a column of a table using the getPrecision() method of the ResultSetMetaData class.//Retrieving the ResultSetMetaData object ResultSetMetaData rsmd = rs.getMetaData(); //getting the column type int size_name = rsmd. getPrecision(3);Assume we have a table named employee_data in the database with description as shown below:+----------+--------------+------+-----+---------+-------+ ... Read More

How to find tables modified in the last hour in Android sqlite?

Nitya Raut

Nitya Raut

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

107 Views

Before getting into example, we should know what sqlite data base in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to ... Read More

Advertisements