Is it recommended to use Database as a container in Production environment?

This blog post lists some reasons why you should not run production databases in containers. It also references another blog post describing problems with updating docker and unstable storage drivers. The main points here for me boil down to this: Dodgy storage drivers. This may be less of a problem when you write your database … Read more

Communicating between Docker containers in different networks on the same host

Containers in different networks can not communicate with each other because iptables drop such packets. This is shown in the DOCKER-ISOLATION-STAGE-1 and DOCKER-ISOLATION-STAGE-2 chains in the filter table. sudo iptables -t filter -vL Rules can be added to DOCKER-USER chain to allow communication between different networks. In the above scenario, the following commands will allow … Read more

Partial match for the key of a std::map

You can’t efficiently search for substring, but you can for prefix: #include <iostream> #include <map> #include <string> #include <algorithm> using namespace std; typedef map<string, string> TStrStrMap; typedef pair<string, string> TStrStrPair; TStrStrMap::const_iterator FindPrefix(const TStrStrMap& map, const string& search_for) { TStrStrMap::const_iterator i = map.lower_bound(search_for); if (i != map.end()) { const string& key = i->first; if (key.compare(0, search_for.size(), … Read more

Best string container: StringCollection, Collection, List, ArrayList, ..?

For what you need, List<string> is probably the most versatile. StringCollection was handy in 1.1, when (without generics) you needed specific classes for typed collections. Collection<string> is handy if you want to subclass it to provide validation etc. Either way, in 3.5, LINQ will provide lots of additional methods for them – but without LINQ, … Read more

What is the major difference between a vector and a stack?

std::vector has several accessibility and modification operations compared to std::stack. In case of std::stack, you may have to perform operations only in systematic way, where you can push() above the last element or pop() the last element. std::vector is more flexible in that sense, where it has several operations, where you can insert() in between … Read more

Copy std::vector into std::array

Use std::copy_n std::array<T, N> arr; std::copy_n(vec.begin(), N, arr.begin()); Edit: I didn’t notice that you’d asked about moving the elements as well. To move, wrap the source iterator in std::move_iterator. std::copy_n(std::make_move_iterator(v.begin()), N, arr.begin());

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)