HTML DOM Link Object

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

306 Views

The HTML DOM Link Object in HTML represents the element.SyntaxFollowing is the syntax −Creating a elementvar linkObject = document.createElement(“LINK”)propertiesHere, “LinkObject” can have the following properties −PropertyDescriptioncrossOriginIt sets/returns the the CORS settings of the linked documentdisabledIt sets/returns whether the linked document is disabled, or nothrefIt sets/returns the URL of the linked documenthreflangIt sets/returns the language code of the linked documentmediaIt sets/returns the media type for the link element tagrelIt sets/returns the relationship between the current and the linked documentsizesIt returns the value of the sizes attribute of the linked documenttypeIt sets/returns the content type of the linked documentExampleLet us ... Read More

Filter Empty String Values from a Java List

Nancy Den
Updated on 30-Jul-2019 22:30:26

1K+ Views

Let’s say we have a String List with an empty value. Here, we have empty array elements before Football and after Squash:List sports = Arrays.asList("", "Football", "Cricket", "Tennis", "Squash", "", "Fencing", "Rugby");Now filter the empty string values. At first, we have used Predicate to negate values:Stream stream = sports.stream(); Predicate empty = String::isEmpty; Predicate emptyRev = empty.negate(); stream.filter(emptyRev).collect(Collectors.toList()));The following is an example to filter empty string values from a List:Exampleimport java.util.Arrays; import java.util.List; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; public class Demo {    public static void main(String[] args) {       List sports = Arrays.asList("", "Football", "Cricket", "Tennis", ... Read More

C++ Program to Implement Affine Cipher

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

3K+ Views

In the Affine cipher, each letter in an alphabet is mapped to its numeric equivalent, is a type of monoalphabetic substitution cipher. Encryption is done using a simple mathematical function and converted back to a letter.The letters of an alphabet of size m are first mapped to the integers in the range 0 … m-1, in the Affine cipher, The ‘key’ for the Affine cipher consists of 2 numbers, a and b. a should be chosen to be relatively prime to m.EncryptionTo transform the integer, it uses modular arithmetic that each plaintext letter corresponds to into another integer that correspond ... Read More

Set JLabel Content Alignment Along the Y-Axis in Java

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

582 Views

Set the alignment of the label’s content along the Y axis on the bottom, use the setVerticalAlignment() method and set the location. Let us first set a label component. We have set the label background color as well so that we can check the alignment of the label’s content properly  −JLabel label = new JLabel("Project Name"); label.setPreferredSize(new Dimension(190, 100)); label.setOpaque(true); label.setBackground(Color.GREEN); label.setForeground(Color.WHITE);Now, we will align the label content along the Y axis on the bottom by seeting location as BOTTOM −label.setVerticalAlignment(JLabel.BOTTOM);The following is an example to set the alignment of the label content along the Y axis in the bottom ... Read More

Check If Table Exists in MySQL and Display Warning

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

434 Views

To check if table exists, use the following syntax −CREATE TABLE IF NOT EXISTS yourTableName (    yourColumnName1 dataType,    .    .    .    .    N );Here, we will try to create a table that already exists and then it will produce a warning message “Table already exists”. Let us first create a table. This table already exists −mysql> CREATE TABLE IF NOT EXISTS DemoTable    (    Id int    ); Query OK, 0 rows affected, 1 warning (0.06 sec)The warning message is as follows −mysql> show warnings;Output+-------+------+-------------------------------------+ | Level | Code | Message ... Read More

HTML Select Autofocus Attribute

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

73 Views

The autofocus attribute of the element in HTML is used to set focus to a drop-down list when the page loads.Following is the syntax −Let us now see an example to implement the autofocus attribute of the element −Example Live Demo Profile Educational Qualification Graduation BCA B.COM B.TECH Postgraduation MCA M.COM M.TECH M.Sc Worked at ABC Corporation from July 2015 - May 2019 as a Technical Manager. ... Read More

HTML DOM link rel Property

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

140 Views

The HTML DOM Link rel property sets/returns the relationship between the current and the linked document and is required to mention.SyntaxFollowing is the syntax −Returning rel attribute valuelinkObject.relSetting rel to a valueStringlinkObject.rel = valueStringValue StringsHere, “valueString” can be the following −valueStringDescriptionalternateIt providesauthorIt provides a link to the author of the linked documentdnsprefetchIt specifies that the browser should pre-emptively perform DNS resolution for the target resource's originhelpIt provides a link to a help document if anyiconIt imports an icon to represent the documentrelIt sets/returns the relationship between the current and the linked documentlicenseIt provides copyright information for the linked documentnextIt provides ... Read More

Initialize a Const Field in Constructor

Samual Sam
Updated on 30-Jul-2019 22:30:26

916 Views

Here we will see how to initialize the const type variable using constructor?To initialize the const value using constructor, we have to use the initialize list. This initializer list is used to initialize the data member of a class. The list of members, that will be initialized, will be present after the constructor after colon. members will be separated using comma.Example#include using namespace std; class MyClass {    private:    const int x;    public:       MyClass(int a) : x(a) {          //constructor       }       void show_x() {   ... Read More

Display Output in JavaScript

vineeth.mariserla
Updated on 30-Jul-2019 22:30:26

2K+ Views

There are 4 ways to display the output in JavaScript. a) Displaying the output in HTML elements, using innerHTML attribute.  Live DemoExample document.getElementById("display").innerHTML = 10 + 10; Output20.b) Displaying the output using document.write(). Live DemoExample document.write(2 + 3); Output5c) Displaying the output through console.log().  Live DemoExample console.log(2 + 3); In debugger console, the output5.d) Displaying the output through alert box. Live DemoExample alert(2 + 3); In alert window box, the output5In case of handling json strings, or some other big data console.log is the best choice.

Bidirectional Iterators in C++

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

470 Views

Here we will see the concept of Bidirectional iterators in C++.The bidirectional iterators support all of the features of forward iterators, and also prefix and postfix decrement operators.This type of iterator can access elements in both directions, like towards the end and towards the beginning.The random access iterator is also a type of bidirectional iterator.Bidirectional iterators have features of forward iterator, but only difference is this iterator can also be decremented.The Bidirectional iterators has some properties. These are like below.PropertyExpressionThe bidirectional iterator is default-constructible, copy-assignable, and also destructibleA pA q(p) q = pWe can compare them using equality and inequality operatorsp ... Read More

Advertisements