Samual Sam has Published 2491 Articles

Add grouping specifiers for large numbers in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

162 Views

For using the Formatter class, import the following package −import java.util.Formatter;We can group specifiers as shown below −Formatter f = new Formatter(); f.format("%, .2f", 38178.9889);The above sets thousands separator and 2 decimal places.The following is an example −Example Live Demoimport java.util.Formatter; public class Demo { public static void ... Read More

Python Pickling

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

14K+ Views

Python pickle module is used for serializing and de-serializing python object structures. The process to converts any kind of python objects (list, dict, etc.) into byte streams (0s and 1s) is called pickling or serialization or flattening or marshalling. We can converts the byte stream (generated through pickling) back into ... Read More

How to detect swipe vertically on a ScrollView using Swift?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

641 Views

To detect swipe in scrollView we will need to make use of some tricks as scroll view does not natively give the directions of scroll made on it. We’ll see this with help of an example.Create an empty project, add scroll view to the view as per your requirement.Give them ... Read More

Set a Minimum Field Width in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

1K+ Views

The minimum field width specifier is what you include between % and the format conversion code.To include a 0 before the field width specifier, pad with 0's. An integer between the % sign and the format conversion code acts as a minimum field width specifier.Let us see an example −Example Live ... Read More

NavigableMap lastEntry() method in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

58 Views

The NavigableMap lastEntry() method returns a key-value mapping associated with the greatest key in this map.Let us first create a NavigableMap and add some elements to it −NavigableMap n = new TreeMap(); n.put(5, "Tom"); n.put(9, "John"); n.put(14, "Jamie"); n.put(1, "Tim"); n.put(4, "Jackie"); n.put(15, "Kurt"); n.put(19, "Tiger"); n.put(24, "Jacob");Now, get the ... Read More

Design a Keylogger in Python

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

4K+ Views

Here we are going to develop a keylogger using python. But before that, what is a keylogger? Keylogger is a program with which we monitor keystrokes. These keystrokes will be stored in a log file. We can record sensitive information like username and password using this keystroke.To create a keylogger ... Read More

Keyed-Hashing for Message Authentication in python

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

616 Views

Message authentication using cryptographic hash functions in python can be achieved through the HMAC mechanism. We can use HMAC with multiple iterable hash functions such as MD5, SHA-1 in combination with a secret shared key.The basic idea is to secure our data, by generating a cryptographic hash of the actual ... Read More

Create a HashMap in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

223 Views

To create a HashMap, use the HashMap map and new −HashMap hm = new HashMap();Now, set elements −hm.put("Finance", new Double(999.87)); hm.put("Operations", new Double(298.64)); hm.put("Marketing", new Double(39.56));Display the elements now using the following code −Example Live Demoimport java.util.*; public class Demo { public static void main(String args[]) { ... Read More

Iterate through a Collection using an Iterator in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

185 Views

A collection in Java provides an architecture to handle a group of objects. The different classes in the Java Collection Framework are ArrayList, LinkedList, HashSet, Vector etc.An Iterator can be used to iterate through a Collection and a program that demonstrates this using ArrayList is given as follows −Example Live Demoimport ... Read More

Barrier Objects in Python

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

382 Views

Barrier provides one of the python synchronization technique with which single or multiple threads wait until a point in a set of activities and make progress together.To define a barrier object, “threading. Barrier” is used.threading.Barrier(parties, action = None, timeout = None)Where, parties = Number of threadsaction = called by one ... Read More

Advertisements