Tag: 5
5 Natural Supplements for Treating STIs in Nigeria.
General Health Blog 5 Natural Supplements for Treating STIs in Nigeria. sexual health One of the major issues with a lot of STIs in Nigeria is that they are becoming antibiotic-resistant which comes with serious complications. And people are looking for natural remedies or alternatives. Luckily, there are natural supplements that can provide solutions to …
5 Natural Supplements for Treating STIs in Nigeria.Read More
C++11 Smart Pointer – Part 5: shared_ptr, Binary trees and the problem of Cyclic References
Main advantage of shared_ptr is that it automatically releases the associated memory when not used any more. But if we don’t use shared_ptr carefully then this advantage can turn into a disadvantage. Let’s look how, Advertisements Suppose I have to design a binary tree and in it the node contains a pointer to left and …
C++11 Multithreading – Part 5: Using mutex to fix Race Conditions
In this article we will discuss how to use mutex locks to protect shared data in multithreaded environment and avoid race conditions. To fix race conditions in multi-threaded environment we need mutex i.e. each thread needs to lock a mutex before modifying or reading the shared data and after modifying the data each thread should …
C++11 Multithreading – Part 5: Using mutex to fix Race ConditionsRead More
Designing a Multiton: Singleton that returns 5 objects in cycle
Let’s Design a Multiton class i.e. a modified Singleton to return 5 objects in cycle. Logic to Create Multiton Advertisements Instead of keeping a static pointer as member variable keep a vector of pointers as member variable. Now also keep track of how many times getInstance() function is called. To do that use static member …
Designing a Multiton: Singleton that returns 5 objects in cycleRead More
5 Different ways to Initialize a vector in c++
In this article we will discuss different ways to initialize a vector in C++. Creating a vector object without any initialization will create an empty vector with no elements i.e. Advertisements std::vector<int> vecOfInts; But we generally want to initialize a vector with huge values and calling push_back() that many times to add element in vector is not an …
Read a file line by line in Python (5 Ways)
In this article we will discuss different ways to read a file line by line in Python. Suppose we have a file data.txt in same directory as our python script. Let’s see how to read it’s contents line by line. Solution for Small Files : Get list of all lines in file using readlines() First …
Python: How to convert integer to string (5 Ways)
In this article we will discuss 5 different ways to convert a integer to string in python. Using str() to convert an int to string in python Python provides a function str(object). It accepts an object as an argument and returns a string representation of that object. So, if we pass the an integer as …
Python: Remove first element from a list (5 Ways)
This article will discuss different ways to delete the first element from a list in Python. Table of Contents Remove the first element from a list in Python using the pop() function Remove the first element from a list in Python using slicing Remove the first element from a list in Python using del keyword …
C++: Print a vector in reverse order (5 Ways)
In this article, we will discuss different ways to print the contents of a vector in reverse order. Table of Contents C++: Print all items of vector in reverse order using reverse iterator C++: Print all items of a vector in reverse order using indexing C++: Print all elements of a vector in reverse order …
C++: Convert Vector to Set ( 5 Ways )
In this article, we will discuss different ways to convert a vector into a set in C++. Convert a Vector to a Set in C++ using Range Based Constructor In C++, set class provides a constructor which accepts a range i.e. [start, end). It creates a set from all the element in the given range …