In this section we will see what is the placement new operator in C++. This placement new is another variation of new operator. The normal new operator performs two things. It allocates memory, and then constructs an object in allocated memory.The new operator allocates memory in the heap section and constructs objects there. But for the placement new operator, it constructs object at the given address. To deallocate memory, we can use delete keyword if the memory is allocated using new operator. But for placement new there is no placement delete feature.So in a nutshell, placement new allows you to ... Read More
This example demonstrate about How to pass multiple data from one activity to another in 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. Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; public class MainActivity extends AppCompatActivity { EditText etName, etAge; @Override protected void onCreate(Bundle savedInstanceState) { ... Read More
To replace dot with comma on SELECT, you can use REPLACE(). Following is the syntax −select replace(yourColumnName, '.' , ', ' ) from yourTableName;Let us first create a table −mysql> create table DemoTable ( Value float ); Query OK, 0 rows affected (0.63 sec)Insert records in the table using insert command −mysql> insert into DemoTable values(4.56); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(456.23); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values(1078.3); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable values(2000.50); Query OK, 1 row affected (0.26 sec) mysql> ... Read More
The master of microcomputer system is the microprocessor since all the operations of a computer are controlled by the microprocessor, the control unit often called as (CU) is found in the microprocessor. In the microcomputer system apart from processor there are several chips of RAM, CHIPS of EPROM and other Input Output port chips, timer 8253 is also present. But surprisingly at any moment of time the remains with only one of the chip. By activation of the chip selection the processor, the selection of the chip of the processor is done. Hence except the processor all chips must have ... Read More
Functions in this module provide usefule information about live objects such as modules, classes, methods, functions, code objects etc. These functions perform type checking, retrieve source code, inspect classes and functions, and examine the interpreter stack.getmembers()− This function returns all the members of an object in a list of name, value pairs sorted by name. If the optional predicate is supplied, only members for which the predicate returns a true value are included. getmodulename() −This function returns the name of the module named by the file path, without including the names of enclosing packagesWe shall be using following script for ... Read More
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 filter data using where Clause and “IS NOT” in Android SQLite.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all ... Read More
This example demonstrate about How to get current area from Network provider 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 a text view to show the current area.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.Manifest; import android.content.pm.PackageManager; import android.location.Address; import android.location.Geocoder; import android.location.Location; import android.location.LocationManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; ... Read More
The builder() method of the DoubleStream class returns a builder for a DoubleStream.The syntax is as follows −static DoubleStream.Builder builder()To use the DoubleStream class in Java, import the following package −import java.util.stream.DoubleStream;The following is an example to implement DoubleStream builder() method in Java −Example Live Demoimport java.util.stream.Stream; import java.util.stream.DoubleStream; public class Demo { public static void main(String[] args) { DoubleStream doubleStream = DoubleStream.builder().add(15.9).build(); doubleStream.forEach(System.out::println); } }Output15.9
The size() method of the AbstractCollection class returns the numbers of elements in the collection. The method returns Integer.MAX_VALUE if the total number of elemnts in the collection exceeds the Interger.MAX_VALUE.The syntax is as follows:public abstract int size()To work with AbstractCollection class in Java, import the following package:import java.util.AbstractCollection;The following is an example to implement AbstractCollection size() method in Java:Example Live Demoimport java.util.ArrayList; import java.util.AbstractCollection; public class Demo { public static void main(String[] args) { AbstractCollection absCollection = new ArrayList(); absCollection.add("Laptop"); absCollection.add("Tablet"); absCollection.add("Mobile"); absCollection.add("E-Book Reader"); ... Read More
This example demonstrate about How to pass large data between activities in 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. Step 3 − Add the following code to src/User.javapackage com.example.myapplication; import java.io.Serializable; public class User implements Serializable { private String city; private String name; private String age; User(String name, String age, String city) { super(); ... Read More