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 of the threads when they are released.timeout = Default timeout value. In case no timeout value is specified for the wait(), this timeout value is used.Below mentioned methods are used by Barrier class.Sr.NoMethod & Description1partiesA number of threads required to reach the common barrier point.2n_waitingNumber of threads waiting in the ... Read More
A procedure should be followed for encrypting an MS word document. Encryption is nothing but protecting your document from a third party. First, let us look into the definition of encryption.What is Encryption? How do we use Encryption?The word encryption is derived from the Greek word Kryptos means hidden or a secret.There are certain algorithms to use encryption like RSA algorithms and Diffie-Hellman key exchange algorithms.These algorithms led to the use of encryption in commercial and consumer realms to protect data.The password is the best example of encryption.Encryption is used in sending data across all the networks and ATM is ... Read More
You can use in-built function date_add() from MySQL. The syntax is as follows −UPDATE yourTableName SET yourDateColumnName=DATE_ADD(yourDateColumnName, interval 1 year);To understand the above syntax, let us first create a table. The query to create a table is as follows −mysql> create table UpdateDate -> ( -> Id int, -> DueDate datetime -> ); Query OK, 0 rows affected (0.76 sec)Insert some records in the table using insert command. The query to insert record is as follows −mysql> insert into UpdateDate values(1001, '2012-5-21'); Query OK, 1 row affected (0.17 ... Read More
Now let us see a program of Intel 8085 Microprocessor. This program will convert 8-bit BCDnumbers to two digit ASCII values.Problem StatementWrite 8085 Assembly language program where an 8-bit BCD number is stored in memory location 8050H. Separate each BCD digit and convert it to corresponding ASCII code and store it to the memory location 8060H and 8061H.DiscussionIn this problem we are using a subroutine to convert one BCD digit(nibble) to its equivalent ASCII values. As the 8-bit BCD number contains two nibbles, so we can execute this subroutine to find ASCIIvalues of them. We can get the lower nibble ... Read More
To get Tail Map from TreeMap, use the tailMap() method. It gets a part or view of the map whose keys are greater than equal to the key set as a parameter.Let us first create a TreeMap −TreeMap m = new TreeMap();Now, we will add some elements −m.put(1, "PHP"); m.put(2, "jQuery"); m.put(3, "JavaScript"); m.put(4, "Ruby"); m.put(5, "Java"); m.put(6, "AngularJS"); m.put(7, "ExpressJS");Get the Tail Map −m.tailMap(4)The following is an example to get Tail Map from TreeMap in Java −Example Live Demoimport java.util.*; public class Demo { public static void main(String args[]){ TreeMap m = new TreeMap(); ... Read More
Use STR_TO_DATE() method from MySQL to convert. The syntax is as follows wherein we are using format specifiers. The format specifiers begin with %.SELECT STR_TO_DATE(yourDateColumnName, '%d.%m.%Y') as anyVariableName FROM yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows.mysql> create table ConvertIntoDateFormat -> ( -> Id int NOT NULL AUTO_INCREMENT, -> LoginDate varchar(30), -> PRIMARY KEY(Id) -> ); Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into ConvertIntoDateFormat(LoginDate) values('11.01.2019'); Query OK, 1 ... Read More
To achieve this, you can use the following syntax in MySQL −select *from yourTableName\G;Here, G can be used for vertical purpose. You need to add yourTableName.Let us create a table in order to understand the above syntax. Creating a table with the help of CREATE command.The following is the query to create a table −mysql> create table TooManyFieldsreturnDemo -> ( -> Id int, -> Name varchar(100), -> Age int -> ); Query OK, 0 rows affected (0.64 sec)Now you can insert records in the table ... Read More
Use the size() method to get the count of elements.Let us first create a HashMap and add elements −HashMap hm = new HashMap(); // Put elements to the map hm.put("Maths", new Integer(98)); hm.put("Science", new Integer(90)); hm.put("English", new Integer(97));Now, get the size −hm.size()The following is an example to get the count of HashMap elements −Example Live Demoimport java.util.*; public class Demo { public static void main(String args[]) { // Create a hash map HashMap hm = new HashMap(); // Put elements ... Read More
You can use binary to search for exact string in MySQL. The syntax is as follows:SELECT * FROM yourTableName WHERE BINARY yourColumnName = yourStringValue;To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table ExactSearch -> ( -> Id int NOT NULL AUTO_INCREMENT, -> UserId varchar(10), -> UserName varchar(20), -> PRIMARY KEY(Id) -> ); Query OK, 0 rows affected (0.69 sec)Insert some records in the table using insert command. The query is as follows:mysql> insert into ExactSearch(UserId, UserName) values('USER12', 'John'); Query OK, 1 row ... Read More
Multithreading ConceptsMultithreading is the core concept of nearly all modern programming languages especially python because of its simplistic implementation of threads.A thread is a sub-program within a program that can be executed independently of other section of the code. A thread executes in the same context sharing program’s runnable resources like memory.When in a single process, we are executing multiple threads simultaneously, it is called multithreading.Python Multithreading Modules for a thread implementationTo implements threads in programs, python provides two modules −thread (for python 2.x) or _thread(for python 3.x) modulethreading moduleWhere the thread module creates a thread as a function whereas ... Read More