containers

symfony2 call is_granted in voter : how to avoid an infinite loop?

梦想的初衷 提交于 2019-12-10 06:00:14
问题 I have built a voter where I need to invoke is_granted on a user. When injecting the security.authorization_checker service in my voter I get the following error ServiceCircularReferenceException in CheckCircularReferencesPass.php line 69: Circular reference detected for service "manager_voter", path: "manager_voter -> security.authorization_checker -> security.access.decision_manager -> manager_voter". Is there no alternative to injecting the whole container? Is this normal? EDIT: I am

Does passing containers by value invalidate iterators?

…衆ロ難τιáo~ 提交于 2019-12-10 03:56:29
问题 Here is some example code: #include <iostream> #include <vector> template <typename T> std::vector<typename T::iterator> f(T t) { std::vector<typename T::iterator> v; for (auto i = t.begin(); i != t.end(); ++i) { v.push_back(i); } return v; } template <typename T> void print(const std::vector<T>& v) { for (auto i = v.begin(); i != v.end(); ++i) { std::cout << **i << ' '; } std::cout << std::endl; } int main() { std::vector<int> v{1, 2, 3}; print(f(v)); std::vector<std::vector<int>::iterator>

Purpose of Container in Fragments for Android

江枫思渺然 提交于 2019-12-10 03:04:03
问题 I am learning fragments but I am failing to understand the significance behind why fragments requires a Container. The way I understand Fragments work is as follows : FragmentActivity setContentview refers to a xml file which defines where fragments would be located. FragmentActivity creates instance of the fragments Then assigns fragment to container. FragmentManager then displays them. The actual Fragment class then inflates a layout, and it is this layout which contains all of the

compiler support for stateful allocators in STL containers

為{幸葍}努か 提交于 2019-12-10 01:42:54
问题 The new C++11 standard requires STL implementations to support stateful allocators in containers. Do main STL implementations (Visual Studio 2008, 2010, libstdc++) comply to this requirement now? I found nothing about this in MSDN or in libstdc++ documentation. 回答1: Looks like the feature of stateful allocators in STL containers is widely supported already. In most cases statefullness of the allocator does not cause trouble. What is not widely supported yet is the new standard's way of

Is there a way to restrict untrusted container scheduler?

女生的网名这么多〃 提交于 2019-12-10 01:21:33
问题 I have an application which I'd like to give the privilege to launch short-lived tasks and schedule these as docker containers. I was thinking of doing this simply via docker run . As I want to make the attack surface as small as possible, I treat the application as untrusted. As such it can potentially run arbitrary docker run commands (if the codebase contained bug or the container was compromised, input was improperly escaped somewhere etc.) against a predefined docker API endpoint. This

Why is 'unbounded_array' more efficient than 'vector'?

梦想的初衷 提交于 2019-12-10 00:44:28
问题 It says here that The unbounded array is similar to a std::vector in that in can grow in size beyond any fixed bound. However unbounded_array is aimed at optimal performance. Therefore unbounded_array does not model a Sequence like std::vector does. What does this mean? 回答1: It appears to lack insert and erase methods. As these may be "slow," ie their performance depends on size() in the vector implementation, they were omitted to prevent the programmer from shooting himself in the foot.

An std container inside a template method

喜你入骨 提交于 2019-12-09 18:06:26
问题 Greetings. I don't know very well how to explain myself, but I believe a piece of code will make you understand what I'm intenting to do : template<class A, class B> void myFunction(A<B>& list) { typename A<B>::iterator current = list.begin(); typename A<B>::iterator end = list.end(); while (current != end) { current++; } } Where A is an STL container (vector, list...). It's like inception, but with templates : a template, inside a template, etc... The thing is : what do you do when one of

Comparing OpenEjb and Glassfish

送分小仙女□ 提交于 2019-12-09 16:30:34
问题 can we replace Glassfish with Tomcat/OpenEJB for lighter applications? What is the performance of OpenEJB comparing to glassfish as EJB container. What is the restrictions of OpenEJB instead of glassfish? Regards 回答1: I guess the question is about the runtime environment but still, I don't understand what lighter application does mean. Memory footprint? Startup time? Deployment time? What problem do you actually have? And please define light. For what it's worth, I consider GlassFish 3 as a

X11 forwarding of GUI app in Docker container

£可爱£侵袭症+ 提交于 2019-12-09 16:22:07
问题 I am currently trying to run some GUI apps in docker containers. I have been trying the ones by jessie frazelle at github. However I can build the images (or get from docker hub) and run them without any visible errors but, the windows don't display (i cant see the app). I am running Docker version 1.13.1 on Ubuntu 16.04 The image is created from: FROM debian:stretch MAINTAINER Jessie Frazelle <jess@linux.com> RUN apt-get update && apt-get install -y \ libreoffice \ --no-install-recommends \

Docker container cannot access internet

爱⌒轻易说出口 提交于 2019-12-09 13:32:02
问题 I'm on my second week of working through this problem and nothing on the internet has helped fix my issue. The problem is that without specifying --net=host, I cannot access the internet from my docker containers. /home/dnadave> docker run -it --net=host --rm debian:jessie ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8): 56 data bytes 64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=12.059 ms 64 bytes from 8.8.8.8: icmp_seq=1 ttl=54 time=11.120 ms ^C--- 8.8.8.8 ping statistics --- 2 packets transmitted, 2