Filter Data Using WHERE Clause and LIKE in Android SQLite

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

754 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.This example demonstrate about How to filter data using where Clause and “LIKE” in Android sqlite.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill ... Read More

Methods to Read HTTP Header in JSP Program

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

422 Views

The request object provides methods to get HTTP header information including form data, cookies, HTTP methods, etc.Following table lists out the important methods that can be used to read HTTP header in your JSP program. These methods are available with HttpServletRequest object which represents client request to webserver.Sr.No.Method & Description1Cookie[] getCookies()Returns an array containing all of the Cookie objects the client sent with this request.2Enumeration getAttributeNames()Returns an Enumeration containing the names of the attributes available to this request.3Enumeration getHeaderNames()Returns an enumeration of all the header names this request contains.4Enumeration getParameterNames()Returns an enumeration of String objects containing the names of the ... Read More

Concat Two Columns in Android SQLite

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

373 Views

Before getting into an example, we should know what sqlite database 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.This example demonstrates How to concat two columns in Android SQLite.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create ... Read More

Create Label-Value Tuple from an Array in Java

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

135 Views

To create LabelValue tuple from an array, use the fromArray() method. First, create an array and add elements to it. After that, use the fromArray() method to create a Tuple and set the array in it.Let us first see what we need to work with JavaTuples. To work with LabelValue class in JavaTuples, you need to import the following package −import org.javatuples.LabelValue;Note − Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project -> Properties -> Java Build Path -> Add External Jars and upload the downloaded JavaTuples jar file. Refer the ... Read More

Sum Columns Across Multiple Tables in MySQL

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

2K+ Views

To sum columns across multiple tables, use UNION ALL. To understand the concept, let us create first table. The query to create first table is as followsmysql> create table Products1    -> (    -> ProductId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> ProductName varchar(20),    -> ProductPrice int    -> ); Query OK, 0 rows affected (0.50 sec)Insert some records in the first table using insert command. The query is as follows −mysql> insert into Products1(ProductName, ProductPrice) values('Product-1', 100); Query OK, 1 row affected (0.22 sec) mysql> insert into Products1(ProductName, ProductPrice) values('Product-2', 200); Query OK, 1 row affected ... Read More

Get DataType of a Column Using JDBC

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

3K+ Views

You can get the datatype of a column of a table using the getColumnType() method of the ResultSetMetaData class.//Retrieving the ResultSetMetaData object ResultSetMetaData rsmd = rs.getMetaData(); //getting the column type String column_name = rsmd.getColumnTypeName(2);Assume we have a table named employee_data in the database with the description as shown below:+----------+--------------+------+-----+---------+-------+ | Field    | Type         | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+-------+ | id       | int(11)      | YES  |     | NULL    | | | Name     | varchar(255) ... Read More

Create Ripple Animation in Android App

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

629 Views

Before getting into the code, we should know what is ripple animation in android. Ripple animation is just like wave momentum. In android it is appears on view like Textview, Button, etc using background attribute.This example demonstrate about how to integrate ripple animation to view.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 added a button with back ground as ripple.Step 3 − Create a file ... Read More

Get MongoDB Databases in a JavaScript Array

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

243 Views

To get MongoDB databases in a JavaScript array, you can use runCommand(). Following is the query to get MongoDB databases in a JavaScript array> use admin; switched to db admin > allDatabasesDetails = db.runCommand({listDatabases: 1});This will produce the following output{    "databases" : [       {          "name" : "admin",          "sizeOnDisk" : 847872,          "empty" : false       },       {          "name" : "config",          "sizeOnDisk" : 98304,          "empty" : false     ... Read More

Treat NULL as 0 and Add Columns in MySQL

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

614 Views

Use the concept of IFNULL() method to treat NULL as 0. Let us first create a table −mysql> create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Value1 int,    Value2 int ); Query OK, 0 rows affected (0.64 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Value1, Value2) values(10, 20); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable(Value1, Value2) values(null, null); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable(Value1, Value2) values(40, null); Query OK, 1 row affected (0.18 sec)Following is the query to display all ... Read More

ByteBuffer asFloatBuffer Method in Java

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

168 Views

A view of the ByteBuffer can be created as a FloatBuffer using the asFloatBuffer() method in the class java.nio.ByteBuffer. This method requires no parameters and it returns a float buffer as required. This buffer reflects the changes made to the original buffer and vice versa.A program that demonstrates this is given as follows −Example Live Demoimport java.nio.*; import java.util.*; public class Demo {    public static void main(String[] args) {       int n = 50;       try {          ByteBuffer bufferB = ByteBuffer.allocate(n);          FloatBuffer bufferF = bufferB.asFloatBuffer();       ... Read More

Advertisements