Use Total Changes in Android SQLite

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

144 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 access this database, you don't need to establish any kind of connections for it like JDBC, ODBC etc.Step 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 ... Read More

Read Form Data Using JSP via GET Method

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

521 Views

Following is an example that passes two values using the HTML FORM and the submit button. We are going to use the same JSP main.jsp to handle this input.                    First Name:                    Last Name:                     Keep this HTML in a file Hello.htm and put it in /webapps/ROOT directory. When you would access http://localhost:8080/Hello.htm, you will receive the following output.First Name: Last Name:   Try to enter the First Name and ... Read More

Get Action Bar Title in Android

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

220 Views

This example demonstrates How to get action bar tittle in android.Step 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.     In the above code, we have taken text view to show status bar tittle.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.app.ActivityManager; import android.app.admin.DevicePolicyManager; import android.content.ComponentName; import android.content.Context; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; public class MainActivity extends AppCompatActivity { ... Read More

MonthDay isBefore Method in Java

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

167 Views

It can be checked if a particular MonthDay is before the other MonthDay in a timeline using the isBefore() method in the MonthDay class in Java. This method requires a single parameter i.e. the MonthDay object that is to be compared. It returns true if the MonthDay object is before the other MonthDay object and false otherwise.A program that demonstrates this is given as followsExample Live Demoimport java.time.*; public class Main {    public static void main(String[] args) {       MonthDay md1 = MonthDay.parse("--02-15");       MonthDay md2 = MonthDay.parse("--02-21");       System.out.println("The MonthDay md1 is: " ... Read More

LocalTime until Method in Java

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

5K+ Views

The difference between two LocalTime objects can be obtained using the until() method in the LocalTime class in Java. This method requires two parameters i.e. the end time for the LocalTime object and the Temporal unit. Also, it returns the difference between two LocalTime objects in the Temporal unit specified.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; import java.time.temporal.*; public class Demo {    public static void main(String[] args) {       LocalTime lt1 = LocalTime.parse("10:15:30");       LocalTime lt2 = LocalTime.parse("12:21:30");       System.out.println("The first LocalTime is: " + lt1);     ... Read More

Convert Number Integer in Minutes to Time in MySQL

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

7K+ Views

To convert number INT in minutes to TIME in MySQL, you can use SEC_TO_TIME() function.The syntax is as followsselect SEC_TO_TIME(yourIntColumnName*60) AS `anyAliasName` from yourTableName;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table convertNumberToMinute    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> NumberToMinute int    -> ); Query OK, 0 rows affected (0.79 sec)Insert some records in the table using insert command.The query is as followsmysql> insert into convertNumberToMinute(NumberToMinute) values(60); Query OK, 1 row affected (0.12 sec) mysql> insert into convertNumberToMinute(NumberToMinute) values(70); Query ... Read More

What Does SET+0 in a MySQL Statement Do

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

134 Views

The set+0 converts the set value to integer. Let us see an example by creating a table −mysql> create table SetZeroDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> TechnicalSkills set('C', 'Spring Framework /Hibernate', 'Python', 'Django Framework', 'Core Java') NOT NULL    -> ); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into SetZeroDemo(TechnicalSkills) -> values('C, Spring Framework /Hibernate, Python, Django Framework, Core Java'); Query OK, 1 row affected (0.20 sec)Display all records from the table using select statement. The ... Read More

Vector Insert Function in C++ STL

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

845 Views

vector insert() function in C++ STL helps to increase the size of a container by inserting the new elements before the elements at the specified position.It is a predefined function in C++ STL.We can insert values with three types of syntaxes1. Insert values by mentioning only the position and value:vector_name.insert(pos, value);2. Insert values by mentioning the position, value and the size:vector_name.insert(pos, size, value);3. Insert values in another empty vector form a filled vector by mentioning the position, where the values are to be inserted and iterators of filled vector:empty_eector_name.insert(pos, iterator1, iterator2);AlgorithmBegin    Declare a vector v with values.    Declare ... Read More

Importance of Function Prototype in C

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

5K+ Views

Here we will see why we should use function prototype in C. The function prototypes are used to tell the compiler about the number of arguments and about the required datatypes of a function parameter, it also tells about the return type of the function. By this information, the compiler cross-checks the function signatures before calling it. If the function prototypes are not mentioned, then the program may be compiled with some warnings, and sometimes generate some strange output.If some function is called somewhere, but its body is not defined yet, that is defined after the current line, then it ... Read More

Drop a Numeric Collection from MongoDB

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

187 Views

In order to remove the numeric collection name, use the following syntaxdb.getCollection("yourNumericCollectionName").drop();First, create a numeric collection. Following is the query> db.createCollection("2536464"); { "ok" : 1 }Now insert some documents in the above collection. Following is the query> db.getCollection("2536464").insertOne({"Record":1}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ca254a46304881c5ce84b8e") } > db.getCollection("2536464").insertOne({"Record":2}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ca254a76304881c5ce84b8f") } > db.getCollection("2536464").insertOne({"Record":3}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ca254a96304881c5ce84b90") }Following is the query to display all documents from a collection with the help of find() method> db.getCollection("2536464").find().pretty();This will produce the following output{ "_id" : ObjectId("5ca254a46304881c5ce84b8e"), "Record" : 1 ... Read More

Advertisements