HTML DOM Input Email Value Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

155 Views

The HTML DOM Input Email value property returns a string, which is the value attribute of input Email. User can also set it to a new string.SyntaxFollowing is the syntax −Returning string valueinputEmailObject.valueSetting value attribute to a string valueinputEmailObject.value = ‘String’ExampleLet us see an example of Input Email value property − Live Demo Input Email value    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;   ... Read More

Mathematical Functions in Python

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

3K+ Views

From doing simple to complex mathematical operations(like trigonometric, logarithmic operations etc) in python we may need to use the math() module.The python math module is used to access mathematical functions. All methods of math() function are used for integer or real type objects but not for complex numbers.To use this function, we need to import it in our codeimport mathConstantsWe use these constants for calculation in python -ConstantsDescriptionsPiReturn the value of pi: 3.141592EReturn the value of natural base e. e is 0.718282tauReturns the value of tau. tau = 6.283185infReturns the infinitenanNot a number typeNumbers and Numeric RepresentationPython provides different functions ... Read More

Floating Point Comparison in C++

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

14K+ Views

Here we will see how to compare two floating point data using C++. The floating point comparison is not similar to the integer comparison.To compare two floating point values, we have to consider the precision in to the comparison. For example, if two numbers are 3.1428 and 3.1415, then they are same up to the precision 0.01, but after that, like 0.001 they are not same.To compare using this criteria, we will find the absolute value after subtracting one floating point number from another, then check whether the result is lesser than the precision value or not. By this we ... Read More

Create Android Notification Intent to Clear Itself

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

375 Views

This example demonstrate about How to create a local Notifications 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.package app.tutorialspoint.com.notifyme ; import android.app.NotificationChannel ; import android.app.NotificationManager ; import android.os.Bundle ; import android.support.v4.app.NotificationCompat ; import android.support.v7.app.AppCompatActivity ; import android.view.View ; public class MainActivity extends AppCompatActivity {    public static final String NOTIFICATION_CHANNEL_ID = "10001" ;    private final static String default_notification_channel_id = "default" ... Read More

Search Documents Through an Integer Array in MongoDB

Anvi Jain
Updated on 30-Jul-2019 22:30:26

335 Views

You can use $where operator for this. Let us first create a collection with documents −>db.searchDocumentArrayIntegerDemo.insertOne({"StudentFirstName":"John", "StudentScores":[45, 78, 89, 90]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd2a219345990cee87fd88c") } >db.searchDocumentArrayIntegerDemo.insertOne({"StudentFirstName":"Larry", "StudentScores":[45, 43, 34, 33]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd2a22a345990cee87fd88d") } >db.searchDocumentArrayIntegerDemo.insertOne({"StudentFirstName":"Chris", "StudentScores":[]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd2a23c345990cee87fd88e") } >db.searchDocumentArrayIntegerDemo.insertOne({"StudentFirstName":"David", "StudentScores":[99]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd2a24d345990cee87fd88f") }Following is the query to display all documents from a collection with the help of find() method −> db.searchDocumentArrayIntegerDemo.find().pretty();This will produce the following output −{    "_id" : ObjectId("5cd2a219345990cee87fd88c"),    "StudentFirstName" : ... Read More

Set a Spinner of Dates in Java

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

242 Views

To set a spinner of dates, at first create a date object −Date today = new Date();Now, use SpinnerDateModel −JSpinner spinner2 = new JSpinner(new SpinnerDateModel(today, null, null, Calendar.MONTH));We will now consider a DateEditor, which is an editor for a JSpinner whose model is a SpinnerDateModel. Set the format for month here −JSpinner.DateEditor editor = new JSpinner.DateEditor(spinner2, "MM"); spinner2.setEditor(editor);The following is an example to set a spinner of date in Java −Examplepackage my; import java.awt.GridBagLayout; import java.util.Calendar; import java.util.Date; import javax.swing.*; public class SwingDemo {    public static void main(String[] args) {       JFrame frame = new JFrame("Spinner Demo"); ... Read More

Set JOptionPane with Predefined Selection in Java

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

245 Views

For predefined selection, use the setSelectedIndex() method, wherein you need to set the index of the item you want to be visible first.Let’s say the following is our aComboBox with elements −Object[] sports = { "Football", "Cricket", "Squash", "Baseball", "Fencing", "Volleyball", "Basketball" }; JComboBox comboBox = new JComboBox(sports);Now, set the initial selection with the index of the item −comboBox.setSelectedIndex(3);The following is an example to set JOptionPane with predefined selection in Java −Examplepackage my; import java.awt.GridBagLayout; import javax.swing.JComboBox; import javax.swing.JOptionPane; import javax.swing.JPanel; public class SwingDemo {    public static void main(String[] args) throws Exception {       JPanel panel = ... Read More

MySQL Query to Find Rows Where ID is Divisible by 4

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

548 Views

Let us first create a table with one of the column as ID −mysql> create table DemoTable    (    ID int,    StudentName varchar(10),    CountryName varchar(20)    ); Query OK, 0 rows affected (0.70 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(0, 'David', 'AUS'); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable values(3, 'Chris', 'UK'); Query OK, 1 row affected (0.27 sec) mysql> insert into DemoTable values(8, 'Carol', 'US'); Query OK, 1 row affected (0.26 sec) mysql> insert into DemoTable values(9, 'Sam', 'US'); Query OK, 1 row affected (0.14 ... Read More

Proper Stack and Heap Usage in C++

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

712 Views

The stack − All variables declared inside the function will take up memory from the stack. So, any local variable inside a function lives on the stack.The heap − This is unused memory of the program and can be used to allocate the memory dynamically when program runs. So If we want something to live longer than the function that declared it, we must allocate it on the heap.Exampleint main() {    int a; //get memory allocated on stack.    int *ptr=new int[7]; //memory for 7 integers allocated on heap. }The main issue in heap memory is fragmentation whereas memory ... Read More

Narrowing with Object in Java

Venkata Sai
Updated on 30-Jul-2019 22:30:26

2K+ Views

Java provides various datatypes to store various data values. It provides 7 primitive datatypes (stores single values) namely, boolean, byte, char, short, int, long, float, double and, reference datatypes (arrays and objects).Type Casting/type conversion −Converting one primitive datatype into another is known as type casting (type conversion) in Java. You can cast the primitive datatypes in two ways namely, Widening and, Narrowing.Narrowing − Converting a higher datatype to a lower datatype is known as narrowing. In this case the casting/conversion is not done automatically, you need to convert explicitly using the cast operator “( )” explicitly. Therefore, it is known ... Read More

Advertisements