HTML DOM Input Email Autofocus Property

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

126 Views

The HTML DOM Input Email autofocus property sets/returns whether Input Email is focused upon initial page load.SyntaxFollowing is the syntax −Returning boolean value - true/falseinputEmailObject.autofocusSetting autofocus to booleanValueinputEmailObject.autofocus = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailstrueIt defines that input will be autofocused on page load.falseIt is the default value and input is not autofocused.ExampleLet us see an example of Input Email autofocus property − Live Demo Input Email autofocus    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;   ... Read More

Print Given 3 Strings After Modifying and Concatenating

Sunidhi Bansal
Updated on 30-Jul-2019 22:30:26

258 Views

Input three strings and replace each string with a character which user has entered and then display edited strings. After that, concatenate edited strings and display them.Input:    string 1 : tutorials replacement character for string 1 : x    String 2 : points replacement character for string 2 : y    String 3: best replacement character for string 3 : z Output :    string 1: xxxxxxxxx    String 2 :yyyyyy    String 3 : zzzz    After concatenation : xxxxxxxxxyyyyyyzzzzAlgorithmSTART Step 1-> declare three array of characters str1, str2 and str3 with variables as ch1, ch2 and ch3 ... Read More

Measure Time Taken by a Function in C

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

15K+ Views

Here we will see how to calculate the time taken by the process. For this problem, we will use the clock() function. The clock() is present in the time.h header file.To get the elapsed time, we can get the time using clock() at the beginning, and at the end of the tasks, then subtract the values to get the differences. After that, we will divide the difference by CLOCK_PER_SEC (Number of clock ticks per second) to get the processor time.Example#include #include void take_enter() {    printf("Press enter to stop the counter ");    while(1) {       ... Read More

Java ResultSetMetaData getCatalogName Method with Example

Rishi Raj
Updated on 30-Jul-2019 22:30:26

266 Views

In general a catalog is a directory which holds information about data sets, file or, a database. Whereas, in a database, catalog holds the list of all the databases, base tables, views (virtual tables), synonyms, value ranges, indexes, users, and user groups.The getCatalogName() method of the ResultSetMetaData (interface) retrieves the name of the catalog of the table containing a particular column.This method accepts an integer value representing the index of the column in the current ResultSet object, as an argument and, returns a String value representing the name of the catalog.To get the ResultSetMetaData object, you need to −Register the Driver: Select the ... Read More

MongoDB Multidimensional Array Projection

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

663 Views

For MongoDB multidimensional array projection, you need to use aggregate framework. Let us first create a collection with documents. Here, we have multidimensional array for Student marks −> db.multiDimensionalArrayProjection.insertOne( ...    { ...       "StudentFirstName" : "Chris", ...       "StudentMarks" : [ [98, 99], [56, 79] ] ...    } ... ); {    "acknowledged" : true,    "insertedId" : ObjectId("5cc6b75a9cb58ca2b005e66c") }Following is the query to display all documents from a collection with the help of find() method −> db.multiDimensionalArrayProjection.find().pretty();This will produce the following output −{    "_id" : ObjectId("5cc6b75a9cb58ca2b005e66c"),    "StudentFirstName" : "Chris",    "StudentMarks" ... Read More

Set a Component Next to Another using GridBagLayout in Java

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

161 Views

We have set a component first −GridBagConstraints constraints = new GridBagConstraints(); constraints.gridy = 0; panel.add(new JButton("First row"), constraints);Now, we will place it next to the previously added component −constraints.gridx = GridBagConstraints.RELATIVE; constraints.gridy = 1; panel.add(new JButton("2nd row 1st column"), constraints); panel.add(new JButton("2nd row 2nd column"), constraints);Examplepackage my; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class SwingDemo {    public static void main(String[] args) {       JFrame frame = new JFrame();       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);       JPanel panel = new JPanel();       panel.setLayout(new GridBagLayout());       GridBagConstraints constraints = new ... Read More

HTML del Cite Attribute

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

186 Views

The cite attribute of the element sets a URL to the HTML document and states why a specific text was deleted. Following is the syntax −Here, url is the link that displays the address of the document wherein it is specified why the text was deleted. Let us now see an example to implement the cite attribute of the element −Example Live Demo Subjects to Learn    JavaScript    A scripting language.    Java    It is a programming language.    jQuery    A JavaScript library.    C#    Object-oriented programming language. Internal Exams from 3rd May ... Read More

C Program That Won't Compile in C++

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

517 Views

The C++ language is designed by adding some additional features like Object Oriented concepts with C. Most of the C programs can be compiled using C++ compiler also. Though there are some programs that cannot be compiled using C++ compiler.Let us see some code, that will compile in C compiler, but not in C++ compilers.In this program there will be one compilation error for C++ code. Because it is trying to call a function that is not declared before. But in C it may compileLive Demo For C.Example Live Demo#include int main() {    myFunction(); // myFunction() is called before its ... Read More

Modifiers Allowed for Methods in an Interface in Java

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

4K+ Views

An interface in Java is a specification of method prototypes. Whenever you need to guide the programmer or, make a contract specifying how the methods and fields of a type should be you can define an interface.In Java 7As of Java7 you can have only public, abstract as modifiers for the methods of an interface.interface MyInterface{ public abstract void display(); public abstract void setName(String name); public abstract void setAge(int age); }Using any other modifier with the methods of an interface would lead to a compile time error.From Java8From Java8 onwards interfaces ... Read More

HTML DOM Input File Upload Disabled Property

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

585 Views

The HTML DOM FileUpload disabled property returns and modify the value of disabled attribute of a FileUpload input type in HTML.SyntaxFollowing is the syntax −1. Returning disabledobject.disabled2. Setting disabledobject.disabled = true|false;ExampleLet us see an example of HTML FileUpload disabled property − Live Demo    body{       background-color:#397367;       color:#fff;       padding:10px;    }    p{       font-size:1.2rem;    }    input{       width:200px;       border:none;       margin:10px 0;    }    .btn{       display:block;       margin:10px 0;       ... Read More

Advertisements