Adding/ concatenating text values within a MySQL SELECT clause?

Arjun Thakur
Updated on 30-Jul-2019 22:30:25
To add/ concatenate text values within a select clause, you can use concat() function.Let us create a tablemysql> create table ConcatenatingDemo -> ( -> UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> UserName varchar(20), -> UserCountryName varchar(20) -> ); Query OK, 0 rows affected (0.82 sec)Now you can insert some records in the table using insert command. The query is as follows −mysql> insert into ConcatenatingDemo(UserName, UserCountryName) values('John', 'US'); Query OK, 1 row affected (0.14 sec) mysql> insert into ConcatenatingDemo(UserName, UserCountryName) values('Carol', 'UK'); Query OK, ... Read More

The toArray(T[]) method of AbstractSequentialList in Java

Nancy Den
Updated on 30-Jul-2019 22:30:25
The difference between toArray() and toArray(T[] arr) is that both the methods returns an array containing all of the elements in this collection, but the latter has some additional features i.e. the runtime type of the returned array is that of the specified array.The syntax is as follows:public T[] toArray(T[] arr)Here, arr is the array into which the elements of this collection are to be stored, To work with the AbstractSequentialList class in Java, you need to import the following package:import java.util.AbstractSequentialList;The following is an example to implement AbstractSequentialList toArray() method in Java:Example Live Demoimport java.util.LinkedList; import java.util.AbstractSequentialList; public class ... Read More

StringStream in C++ for Decimal to Hexadecimal and back

Nancy Den
Updated on 30-Jul-2019 22:30:25
In this section we will see how to convert Decimal to Hexadecimal string and also from Hexadecimal string to Decimal string in C++. For this conversion we are using the stringstream feature of C++.String streams are used for formatting, parsing, converting a string into numeric values etc. The Hex is an IO manipulator. It takes reference to an IO stream as parameter and returns reference to the string after manipulating it.In the following example we will see how to convert decimal number or hexadecimal number.Example Code#include #include using namespace std; main(){    int decimal = 61;    stringstream my_ss;   ... Read More

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
Advertisements