containers

Why STL containers are preferred over MFC containers?

Previously I used to use MFC collection classes such CArray and CMap. After a while I switched to STL containers and have been using them for a while. Although I find STL much better, I am unable to pin point the exact reasons for it. Some of the reasoning such as : It requires MFC: does not hold because other parts of my program uses ...

Taking iterators two at a time?

I'll often represent and process polylines like so: typedef std::vector< Point_t > Polyline_t; double PolylineLength(const Polyline_t& line) { double len = 0.0; for( size_t i = 0; i < line.size()-1; ++i ) len += (line[i+1]-line[i+0]).length(); return len; } The most straightforward conversion to bidirectional iter...

Trying to adapt the Dojo Toolkit "Highlight Container"

Hello! I am using the "Highlight Container" effect in the Dojo Toolkit (as shown here). My problem comes when I have a DIV that contains a TEXTAREA instead of a text field. I am not sure how to get it to recognize either a text field or a textarea. The code function is as follows: dojo.addOnLoad(function() { dojo.query(".container...

Zend Form and nested fieldsets/containers?

I have a form. I have a single element that needs to be wrapped in a div or fieldset (for formatting). Then I have two groups of elements, including the above, that I want to wrap in a fieldset or div. I've managed to create two groups, but Zend Form seems to balk at letting me create a group containing a group. Should I be able to do th...

Getting the Iterator for an inner STL Container?

Hey guys, I am having trouble trying to get iterators for inner sub-containers. Basically imagine this simplified code: typedef map<string, map<string, map> > double_map; double_map dm; .. //some code here for(double_map::iterator it = dm.begin(); it != dm.end(); it++){ //some code here it->first // string it->second // <...

STL map onto itself?

I'd like to create a std::map that contains a std::vector of iterators into itself, to implement a simple adjacency list-based graph structure. However, the type declaration has me stumped: it would seem you need the entire map type definition to get the iterator type of said map, like so: map< int, Something >::iterator MyMap_it; /...

c# file container

Hello! I am searching for a way to add several files into one file, much like a Zip file. I need to be able to create a file container on the fly and add several word documents, images and other important files into the container. My criteria is that you don't need to install any additional software on the computer (preferebly only a .D...

How to specify Http Request timeout parameter on Java servlet container

Hi, I'm trying to understand where I can configure a request timeout for all requests arriving to a servlet of mine (or all of my servlets)? Is that, as I think, a container property? Also, how does this affect different browsers? Do they all comply to the parameter the container dictates? Or maybe the request timeout time isn't even so...

flex spacing inside vbox , hbox

children inside hbox and vbox have spacing between them, how do you remove this empty space i need to have 0 space between child elements of a hbox or vbox ...

C# Design template containers?

I have been trying to find a good guide to create a templated control. I am trying to display a few pictures on several different parts of my website so I wanted to add a template control to allow me to modify the HTML before it renders. Something like: <cc1:photos runat="server" id="myPhotos"> <photoCell> <img src="<%# photo %>" al...

Container.remove(int i) throws unexpected ArrayIndexOutOfBoundsException

I'm trying to remove all but the first child component from a Java Container. The following code logs "There are 3" and throws an ArrayIndexOutOfBoundsException: Array index out of range: 2 int componentCount = cardPanel.getComponentCount(); logger.info("There are " + componentCount); for (int i = 1; i < componentCount; i++) { card...

How to create a container of noncopyable elements

Is there a way use STL containters with non-copyable elements? something like this: class noncopyable { noncopyable(noncopyable&); const noncopyable& operator=(noncopyable&); public: noncopyable(){}; }; int main() { list<noncopyable> MyList; //error C2248: 'noncopyable::noncopyable' : cannot access private member decla...

Ada Ada.Containers Clear Procedure Problem

Has anyone had trouble with the Clear procedure found in the Ada.Containers package? It seems to set the Container's length to zero, but once another element is added using the Append procedure, the contents of the Container reappear (i.e. they never get removed). I've tried both Ada.Containers.Doubly_Linked_Lists and Ada.Containers.Ve...

How to shutdown a servlet container from within a servlet?

Is there a portable way to request a Servlet container to shutdown gracefully, from within a servlet? By portable I mean a technique that will work on all standard compliant containers (Tomcat, Jetty, Winstone, etc). Note that this is the opposite of the Servlet.destroy() method, which gets called when the container is taking the servl...

Should I expose iterators and adaptor methods or a whole container in C++?

Consider the piece of code: class Foo { // ... std::vector<Bar> bars; }; Should I expose the whole container, or should I expose typedef'd iterator class and write adaptor methods (begin(), end(), size(), and whatever I need)? If the answer is it depends, how should one make a decision? ...

Can I use std::stack as object pool container?

I need to create a pool of objects to eliminate dynamic allocations. Is it efficient to use std::stack to contain pointers of allocated objects? I suspect every time I push the released object back to stack a new stack element will be dynamically allocated. Am I right? Should I use std::vector to make sure nothing new is allocated? Tha...

asking the container to notify your application whenever a session is about to timeout in Java

Which method(s) can be used to ask the container to notify your application whenever a session is about to timeout?(choose all that apply) A. HttpSessionListener.sessionDestroyed -- correct B. HttpSessionBindingListener.valueBound C. HttpSessionBindingListener.valueUnbound -- correct this is kind of round-about but ...

How can I get all controls from a Form Including controls in any container?

I need for example to disable all buttons in a form or validate all textbox's data... any Ideas.. thanks in advance!!! ...

Which STL Container?

I need a container (not necessarily a STL container) which let me do the following easily: Insertion and removal of elements at any position Accessing elements by their index Iterate over the elements in any order I used std::list, but it won't let me insert at any position (it does, but for that I'll have to iterate over all element...

boost::unordered_map maintains order of insertion?

I am looking for a container which provides std::map like interface but maintains the order in which elements are inserted. Since there will not be too many elements in the map, the lookup performance is not a big issue. Is boost::unordered_map will work in this case? i.e. does it maintain the order of insertion. I am new to boost librar...