How to dynamically update a ListView on Android

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25
This example demonstrates How to dynamically update a ListView on 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.     In the above code, we have taken listview.Step 3 − Add the following code to src/MainActivity.javaHow to dynamically update a ListView on AndroidLet's try to run your application. I assume you have connected your actual Android Mobile device with your computer. To run the app from android studio, open one of your project's ... Read More

Non-persistent CSMA protocol

Fendadis John
Updated on 30-Jul-2019 22:30:25
Non-persistent CSMA is a non – aggressive version of Carrier Sense Multiple Access (CMSA) protocol that operates in the Medium Access Control (MAC) layer. Using CMSA protocols, more than one users or nodes send and receive data through a shared medium that may be a single cable or optical fiber connecting multiple nodes, or a portion of the wireless spectrum.In non-persistent CSMA, when a transmitting station has a frame to send and it senses a busy channel, it waits for a random period of time without sensing the channel in the interim, and repeats the algorithm again.AlgorithmThe algorithm of non-persistent ... Read More

Convert C/C++ program to Preprocessor code\

Smita Kapse
Updated on 30-Jul-2019 22:30:25
Here we will see how to generate the preprocessed or preprocessor code from the source code of a C or C++ program.To see the preprocessed code using g++ compiler, we have to use the ‘-E’ option with the g++.Preprocessor includes all of the # directives in the code, and also expands the MACRO function.Syntaxg++ -E program.cppExample#define PI 3.1415 int main() {    float a = PI, r = 5;    float c = a * r * r;    return 0; }Output$ g++ -E test_prog.cpp int main() {    float a = 3.1415, r = 5;    float c = a * r * r;    return 0; }

“volatile” qualifier in C

Anvi Jain
Updated on 30-Jul-2019 22:30:25
Here we will see what is the meaning of volatile qualifier in C++. The volatile qualifier is applied to a variable when we declare it. It is used to tell the compiler, that the value may change at any time. These are some properties of volatile.The volatile keyword cannot remove the memory assignmentIt cannot cache the variables in register.The value cannot change in order of assignment.Let us see, how we can use the volatile keyword.volatile int a; int volatile a;Here these two declarations are correct. Like other datatypes, we can use volatile pointers, structures, unions etc. The volatile structures and ... Read More

8085 Program to check for two out of five code

Arjun Thakur
Updated on 30-Jul-2019 22:30:25
Now let us see a program of Intel 8085 Microprocessor. This program will help us to check a given value is a valid 2 out of 5 code or not.Problem Statement:Write 8085 Assembly language program to check whether a given number is 2 out of five code or not. The number is stored at location 8000H.Discussion:The checking of two out of five code is simple. At first we have to check the higher order three bits are 0 or not. If they are 0, then we will check next five bits. If there are exactly two 1s in these 5-bits, ... Read More

8085 program to reverse 16 bit number

Arjun Thakur
Updated on 30-Jul-2019 22:30:25
In this program we will see how to reverse the digits of a 16-bit number using 8085.Problem StatementWrite 8085 Assembly language program to reverse a 16-bit number stored at location 8000H-8001H. Also, store the result at 8050H – 8051H.DiscussionHere the task is too simple. There are some rotating instructions in 8085. The RRC, RLC are used to rotate the Accumulator content to the right and left respectively without carry. We can use either RRC or RLC to perform this task. In the final result each digit of the H and L are reversed, and also the H and L values ... Read More

How to filter data using where Clause and “NOT IN” in Android sqlite?

Anvi Jain
Updated on 30-Jul-2019 22:30:25
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 “NOT IN” in Android sqlite.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and ... Read More

Get a value from Triplet class in JavaTuples

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25
The getValueX() method is used to get a value from the Triplet Tuple class in Java at a particular index. For example, getValue0().Let us first see what we need to work with JavaTuples. To work with Triplet class in JavaTuples, you need to import the following package −import org.javatuples.Triplet;Note − Steps to download and run JavaTuples program. If you are using Eclipse IDE to run Triplet Class in JavaTuples, then Right Click Project → Properties → Java Build Path → Add External Jars and upload the downloaded JavaTuples jar file.The following is an example −Exampleimport org.javatuples.Triplet; public class Demo { ... Read More

How to write a comment in a JSP page?

Samual Sam
Updated on 30-Jul-2019 22:30:25
JSP comment marks to text or statements that the JSP container should ignore. A JSP comment is useful when you want to hide or "comment out", a part of your JSP page.Following is the syntax of the JSP comments −Following example shows the JSP Comments − A Comment Test A Test of Comments The above code will generate the following result −A Test of CommentsThere ... Read More

How to insert an image in to Oracle database using Java program?

Nancy Den
Updated on 30-Jul-2019 22:30:25
To hold an image in Oracle database generally blob type is used. Therefore, make sure that you have a table created with a blob datatype as:Name Null? Type ----------------------------------------- -------- ---------------------------- NAME VARCHAR2(255) IMAGE BLOBTo insert an image in to Oracle database, follow the steps given below:Step 1: Connect to the databaseYou can connect to a database using the getConnection() method of the DriverManager classConnect to the Oracle database by passing the Oracle URL which is jdbc:oracle:thin:@localhost:1521/xe (for express edition), username and password as parameters to the getConnection() method.String oracleUrl = "jdbc:oracle:thin:@localhost:1521/xe"; Connection con = DriverManager.getConnection(oracleUrl, "user_name", "password");Step 2: Create ... Read More
Advertisements