containers

Does map::iterator yield lvalues ?

In other words, when i is a map<K,V>::iterator, do the following provide the expected semantics (ie. it modifies the map): *i = make_pair(k, v); i->first = k; i->second = v; ? Update: The first two lines are invalid, since the return value of operator* is (convertible to?) a pair<const K, V>. What about the third line ? Assuming a y...

How to get ExtJS Layout used for Container

Hi, is there a way to find out which layout type is used for a container. For instance. When I use the following code to get a container how can I determine the layout type. comp = Ext.getCmp('<name>'); comp.getLayout(); I only get a layout object but there is no field from the object which tells me the layout type ...

Using JNDI to access a DataSource (Tomcat 6)

Hi there, I have been trying to set up a Database Connection Pool for my test webapp just to learn how it's done really. I have managed to get a DataSource object connected to my database which supplies me with Connection objects now, so that's good. I must admit I don't really know exactly how it's working. I wrote some test code to s...

C++: Container of original pointers

Hello folks, I need to store references to instances of derived classes in C++. I considered using a vector of shared_ptrs to the base class (for it needs to hold different types of derived classes), however, it's important that the container holds the original pointers, which is not the case with vectors (or other stl containers), if I...

How to Create a Custom Container in ASP.NET

I am not sure if I have this right ... but can anyone point me to a resource that shows how to create a custom container in ASP.NET (Specifically MVC). By container I am talking about a container that is globally available during a session like a DI container (i.e. Ninject or UNity). Thanks in advance. ...

Should I use boost::ptr_vector<T> or vector<boost::shared_ptr<T> >?

I need a container of pointers. Would you recommend boost::ptr_vector<T> or std::vector<boost::shared_ptr<T> >? (Or something else?) If that's of interest, my actual data structure is relatively complicated (see here) and currently stores objects, not pointers, but i'd like to change that (using pointer containers), in order to get rid ...

Scheme to play video file in own container format on Mac OS X

I am planning to write an application (C/C++/Objective-C) that will play media files in own (private) container format. The files will contain: multiple video streams, encoded by a video codec (like XVid or H264, it is supposed, that components capable of decoding the viideo formats are present in the system); multiple audio streams in s...

Handling one object in some containers

I want to store pointers to one instance of an object in some (two or more) containers. I've met one problem in this idea: how I can handle removing of this object. Objects have rather stormy life (I am talking about game, but I think this situation is not so specific) and can be removed rather often. To my mind this problem is divided i...

Determining site/container of .NET extender provider

I created a .NET class derived from Component and implementing IExtenderProvider. I placed this provider on a Form. However, neither the site or the container is ever initialized. They are always null, whether in design mode or at runtime. Is there a way to determine the Form that contains the provider object? This seems so obvious,...

using intrusive containers to tokenize a wide c string

I was wondering if I could tokenize my string (lpcwszBuffer) using boost::tokenizer without making a copy of the string. I heard about using intrusive containers to avoid giant memory footprints, but I'm not really sure if it's applicable here. If I was unclear, here's what I mean: size_t Tokenize(const wchar_t* lpcwszBuffer, boost::sc...

What are Containers/Adapters? C++

What are containers/adapters? Someone please explain in layman's language. I have tried to look up on the internet but the definitions and explanations are too technical and hard to understand. I have basic knowledge of C++ and its sub-topics like (class/templates/STL). EDIT 1: Can anyone please give me a practical example of the ap...

Change BorderContainer background color with AS - Flex 4

I'm trying to change the background color and or text color of a BorderContainer in flex 4 using Action Script, but have not idea how to. The Border Container component doesn't seem to have any properties like: idname.color = "#333333"; idname.backgroundcolor = "#333333"; How might I go about doing this? thanks! ...

C++: access to container of shared_ptr should return raw or shared ptr?

If I use a container of shared_ptrs and explicitely allow access to its elements, should I return shared_ptrs or raw pointers if I intend the container to be the one responsible for "cleaning up"? class Container { private: std:vector<shared_ptr<Foo> > foo_ptrs; public: shared_ptr<Foo> operator[](std::size_t index) const {}; //...

Functional Code Breaks When Used Twice.

I'm still working on my Field class, and tried to improve my piss-poor insertion/erase performance. However, the new function works once, then breaks catastrophically when I use it a second time. This is the code: template <class T> T *Field<T>::insert(const T *pPos, const T& data) { // Special case: field is empty. insert shoul...

Adding child container using sencha

Hello, I am trying to add a container into a popup window.For that I created a container and a pop window.But i can't place the container in a pop window.Is there any way to place it. Thanks ...

How to remove a specific pair from a C++ multimap?

#include <map> ... multimap<char,int> first; first.insert(pair<char,int>('a',10)); first.insert(pair<char,int>('b',15)); first.insert(pair<char,int>('b',20)); first.insert(pair<char,int>('c',25)); Say I now want to remove one of the pairs I have just added to the map. I have examples to remove an entire key entry, which for key 'b'...

C++ To call member function in for_each for items in the member container.

If I have a class (that mimic some of STL's container) like this: class Elem { public: void prepare(); // do something on *this // ... }; class Selector { public: typedef vector<Elem *> container_type; typedef container_type::iterator iterator; iterator begin() { return cont_.begin(); } iterator end() { return cont_.end(...

Bottom-Margin with varying content height

Hi, I have a problem I have been trying to solve, but without any progress. This is a summary of my code: <div id="container"> <div id ="content"> Some content here (Varying height) </div> </div> body { background-image: url('img/bg_Body.gif'); margin:0px 0px 0px 0px; } #container { position: relativ...

Own "in-place activation" OLE Server

Hello, I just want to create my own OLE server, which support in-place activation. e.g. In TOlecontrol we can do following: OleContainer1.CreateObject('WORD.Document',FALSE); That is ok. Word document is embeded into the main application form. But when I tried: OleContainer1.CreateObject('Server.MyOleServer',FALSE); MyOleServer is...

Constructing associative containers

I was convinced (until I just tried it a moment ago) that it was possible to instantiate an associative container with array style notation. For example, std::set< int > _set = { 2, 3, 5 }; This isn't the case but I am wondering if there is any other way of bulk initialising a container in the constructor like this? ...