C++ Program to Implement the Vigenere Cypher

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

6K+ Views

Vigenere Cipher is a kind of polyalphabetic substitution method of encrypting alphabetic text.Vigenere Cipher Table is used in which alphabets from A to Z are written in 26 rows, for encryption and decryption in this method.EncryptionKey: WELCOMEMessage: ThisistutorialspointHere we have to obtain a key by repeating the given key till its length becomes equal to original message length.For encryption take first letter of message and key i.e. T and W. Take the alphabet in Vigenere Cipher Table where T row and W column coincides i.e. P.Repeat the same process for all remaining alphabets in message text.Finally, the encrypted message text ... Read More

Output Iterators in C++

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

488 Views

Here we will see what are the Output iterators in C++. The Output iterators has some properties. These are like below:The output iterators are used to modify the value of the containers.We cannot read data from container using this kind of iteratorsThis is One-Way and Write only iteratorIt can be incremented, but cannot be decremented.There are two sub-parts of Output iterators. These are Insert Iterator and ostream iterator.The Insert IteratorThe insert iterator is used to insert some element inside the container. The assignment operator on this type of iterator inserts new element at current position. The syntax of insert iterator ... Read More

How to create an invisible fixed width component between two components in Java?

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

197 Views

Use the createHorizontalStrut() method to create an invisible width component between two components. Let’s say we have some button and we are creating a fixed width between them −box.add(button4); box.add(Box.createHorizontalStrut(50)); box.add(button5); box.add(Box.createHorizontalStrut(30)); box.add(button6);The following is an example to create an invisible fixed width component between two components −Examplepackage my; import java.awt.BorderLayout; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JScrollPane; public class SwingDemo {    public static void main(String args[]) {       JFrame frame = new JFrame("Groups");       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);       JButton button1 = new JButton("CSK");       JButton button2 = new JButton("DC"); ... Read More

MongoDB Query to search for records only in a specific hour?

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

429 Views

For this, use the $hour operator. Let us first create a collection with documents with one of the field as date −> db.mongoDbSearchForHoursDemo.insertOne({"CustomerName":"Larry", "OrderDatetime":new ISODate("2019-01-31 09:45:50")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6e8a86d78f205348bc62a") } > db.mongoDbSearchForHoursDemo.insertOne({"CustomerName":"Larry", "OrderDatetime":new ISODate("2019-02-21 01:10:01")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6e8b86d78f205348bc62b") } > db.mongoDbSearchForHoursDemo.insertOne({"CustomerName":"Larry", "OrderDatetime":new ISODate("2019-04-01 04:10:11")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6e8e26d78f205348bc62c") } > db.mongoDbSearchForHoursDemo.insertOne({"CustomerName":"Larry", "OrderDatetime":new ISODate("2019-05-11 08:53:01")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6e8f26d78f205348bc62d") }Following is the query to display all documents from a collection with the help of find() method −> db.mongoDbSearchForHoursDemo.find().pretty();This will ... Read More

HTML
Tag

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

155 Views

The tag in HTML is used to define header, footer, lesson, etc. in an HTML document, which is what we can call the sections.Let us now see an example to implement the tag −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. OutputIn the above ... Read More

Custom len() Function In Python

Hafeezul Kareem
Updated on 30-Jul-2019 22:30:26

646 Views

Let's see how can we implement custom len() function in Python. Try it by yourself first using the following steps.StepsGet the iterator from the user string/list/tuple.Define a function with a custom name as you like and invoke it by passing the iterator.Initialize the count to 0.Run a loop until it reaches the end.Increment the count by 1Return the count.Example Live Demo## function to calculate lenght of the iterator def length(iterator):    ## initializing the count to 0    count = 0    ## iterating through the iterator    for item in iterator:       ## incrementing count       ... Read More

HTML DOM Input Month stepDown() Method

Sharon Christine
Updated on 30-Jul-2019 22:30:26

32 Views

The HTML DOM input month stepDown() method steps down (decrement) the value of input month field by a specified value.SyntaxFollowing is the syntax −object.stepDown(number)Here, if number parameter is omitted then it decrements the value by 1.ExampleLet us see an example of input month stepDown() method − Live Demo HTML DOM stepUp()/stepDown() Demo body{ text-align:center; background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) center/cover no-repeat; height:100vh; color:#fff; ... Read More

HTML DOM Link Object

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

194 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

How to filter empty string values from a Java List?

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

628 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

2K+ 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

Advertisements