HTML DOM Link href Property

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

184 Views

The HTML DOM Link href property sets/returns the path/url of a linked document. −SyntaxFollowing is the syntax −Returning href attribute valuelinkObject.hrefSetting href to a stringlinkObject.href = stringBoolean ValuesHere, “string” can be the following −booleanValueDetailspathIt defines the absolute/relative path to a document.urlIt defines the url address of the document to be linked.ExampleLet us see an example for Link href property − Link href Link-href Sales Target Week:    var divDisplay = document.getElementById("divDisplay");    var inputWeek = document.getElementById("WeekSelect");    var extStyle = document.getElementById("extStyle");    divDisplay.textContent = 'Week ... Read More

How to count element after filtering in Java?

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

318 Views

Let’s say the following is the String List:List list = new ArrayList(); list.add("Tom"); list.add("John"); list.add("David"); list.add("Paul"); list.add("Gayle"); list.add("Narine"); list.add("Joseph");Now, let’s say you need to filter elements beginning with a specific letter. For that, use filter() and startsWith():long res = list    .stream()    .filter((s) -> s.startsWith("J"))    .count();We have also counted the elements above after filtering using count().The following is an example to count element after filtering in Java:Exampleimport java.util.ArrayList; import java.util.List; public class Demo {    public static void main(final String[] args) {       List list = new ArrayList();       list.add("Tom");       list.add("John"); ... Read More

C++ Program to Implement the Hill Cypher

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

5K+ Views

Based on linear algebra Hill cipher is a polygraphic substitution cipher in cryptography.To encrypt message: The key string and message string are represented as matrix form. They are multiplied then, against modulo 26. The key matrix should have inverse to decrypt the message.To decrypt message: The encrypted message is multiplied by inverse key matrix used for encryption against modulo 26 to get decrypt message.For exampleKey matrix1 0 1 2 4 0 3 5 6Message string ‘ABC’ in matrix form −0 1 2For encryptionAfter multiplying above two matrices we get, 2 4 17Which will be the encrypted message ‘CER’For decryptionInverse of ... Read More

Composite Design Pattern in C++

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

1K+ Views

Composite pattern is used where we need to treat a group of objects in similar way as a single object. Composite pattern composes objects in term of a tree structure to represent part as well as whole hierarchy. This type of design pattern comes under structural pattern as this pattern creates a tree structure of group of objects.This pattern creates a class that contains group of its own objects. This class provides ways to modify its group of same objects.We are demonstrating use of composite pattern via following example in which we will show employees hierarchy of an organization.Here we ... Read More

Set the alignment of the JLabel content along the X axis on the right in Java

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

122 Views

To set the alignment of the label’s content along the X axis on the right, use the setHorizontalAlignment() 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("Stationery"); 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 X axis on the top by seeting location as RIGHT −label.setHorizontalAlignment(JLabel.RIGHT);The following is an example: to set the alignment of the label content along the X axis on the right ... Read More

How to apply NOW() to timestamps field in MySQL Workbench?

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

667 Views

Let us first create a table −create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ShippingDate timestamp );Insert some records in the table using insert command. Here, we have included the current date with NOW() −INSERT INTO DemoTable(ShippingDate) VALUES(now());Display all records from the table using select statement −SELECT *FROM DemoTable;OutputFollowing is the screenshot of query in MySQL workbench to set NOW() to timestamp field “ShippingDate”. The query also displays the output below −

How to compare pointers in C/C++?

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

6K+ Views

We can compare pointers if they are pointing to the same array. Relational pointers can be used to compare two pointers. Pointers can’t be multiplied or divided.In CExample Live Demo#include int main() {    int *p2;    int *p1;    p2 = (int *)300;    p1 = (int *)200;    if(p1 > p2) {       printf("P1 is greater than p2");    } else {       printf("P2 is greater than p1");    }    return(0); }OutputP2 is greater than p1In C++Example#include using namespace std; int main() {    int *p2;    int *p1;    p2 = (int *)300;    p1 = (int *)200;    if(p1>p2) {       cout

Is Python Object Oriented or Procedural?

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

3K+ Views

Yes, Python support both Object  Oriented and Procedural  Programming language as it is a high level programming language designed for general purpose programming. Python are multi-paradigm, you can write programs or libraries that are largely procedural, object-oriented, or functional in all of these languages. It depends on what you mean by functional. Python does have some features of a functional language. OOP's concepts like, Classes, Encapsulation, Polymorphism, Inheritance etc.. in Python makes it as a object oriented programming language. In Similar way we can created procedural program through python using loops ,for ,while etc ..and control structure.Exampleclass Rectangle:    def __init__(self, length, breadth, ... Read More

HTML DOM Link hreflang Property

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

82 Views

The Link hreflang property sets/returns the language code of a linked document.SyntaxFollowing is the syntax −Returning hreflang attribute valuelinkObject.hreflangSetting hreflang to a language codelinkObject.hreflang = langCodeExampleLet us see an example for Link hreflang property − Live Demo Link hreflang Link-hreflang Spanish    var divDisplay = document.getElementById("divDisplay");    var extStyle = document.getElementById("extStyle");    function changeStyle(){       if(extStyle.hreflang === 'en'){          divDisplay.textContent = 'The linked document is written in english';          document.getElementsByTagName('h3')[0].textContent = 'English'       }    } In ... Read More

How to generate a random number in C++?

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

295 Views

Let us see how to generate random numbers using C++. Here we are generating a random number in range 0 to some value. (In this program the max value is 100).To perform this operation we are using the srand() function. This is in the C library. The function void srand(unsigned int seed) seeds the random number generator used by the function rand.The declaration of srand() is like below −void srand(unsigned int seed)It takes a parameter called seed. This is an integer value to be used as seed by the pseudorandom number generator algorithm. This function returns nothing.To get the number ... Read More

Advertisements