containers

C++ multi-dimensional data handling

Many times, I find myself having to define a container for multi-dimensional data. Let's take an example: I have many Chips, each Chip has many Registers, each Register has many Cells, and each Cell has many Transistors. At some stage of my C++ program I have to read this data, and later I have to use it. I cannot use any external sto...

Silverlight stretch child element to fill parent container?

In Silverlight, how can I stretch the width of a Line to fill the width of the StackPanel in which it is a child element? Prefer a XAML solution, not a code-behind. Here is how I can do it in WPF: <Line X1="0" X2="{Binding Path=ActualWidth, ElementName=HolePatternStackPanel}" Stroke="Gray" StrokeThickness="1" /> But that does not work...

What does this mean in Prism/Unity: Container.Resolve<ShellPresenter>()

(from the StockTraderRIBootstrapper.cs file in the Prism V2 StockTrader example app) What is the difference between this: ShellPresenter presenter = new ShellPresenter(); and this: ShellPresenter presenter = Container.Resolve<ShellPresenter>(); I understand the second example is treating the container like a factory, walking up t...

Returning a pointer to a vector element in c++.

I have a vector of myObjects in global scope. I have a method which uses a std::vector<myObject>::const_iterator to traverse the vector, and doing some comparisons to find a specific element. Once I have found the required element, I want to be able to return a pointer to it (the vector exists in global scope). If I return &iterator, am...

Custom STL Containers

I have written code that allows one to traverse mapped data in the order it was entered. The solution I coded a couple of times was: Given a keytype, K, and and data type, D, std::map std::vector When one wanted to randomly find a data entry, use map.find(K). When one wanted to traverse the map in entry order, use std::vect...

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

What is the most suitable container just for strings holding in some array with non-predetermined upper boundary, which length is unknown on it's creation. For simple code like: Foo list = new Foo(); // size in unknown for()/foreach()/do()/while() // any loop { list.Add(string); } Is it StringCollection as optimized Collection for ...

Right Float and container div

Hi, I have 3 divs in a container div. The first is floated left, the second is floated right and the last sits in the center. This creates 3 approximately even divs across a container div. In each of these divs I am placing an image of varying heights. Then there is a separate div to sit below the container div which will be the full w...

C++ STL: Which method of iteration over a STL container is better?

This may seem frivolous to some of you, but which of the following 2 methods of iteration over a STL container is better? Why? class Elem; typedef vector<Elem> ElemVec; ElemVec elemVec; // Method 0 for (ElemVec::iterator i = elemVec.begin(); i != elemVec.end(); ++i) { Elem& e = *i; // Do something } // Method 1 for (int i = 0;...

Is it possible to configure ms Unity container from an xml document and NOT from a file?

Is it possible to configure ms Unity container from an xml document and NOT from a file? thx ...

'Multipurpose' linked list implementation in pure C

( if you get easily bored reading long posts, you can focus on the bold parts ) Hello all! This is not exactly a technical question, since I know C kind of enough to do the things I need to (I mean, in terms of not 'letting the language get in your way'), so this question is basically a 'what direction to take' question. Situation is: ...

Creation of solaris zone

For these part : zonecfg:[zone name]:net> set address= zonecfg:[zone name]:net> set physical= How do i know what kind of values i should set? I am using a vmware machine open solaris and current setting up a zone. I want to be able to putty in to that zone. Thanks ...

Mapping between stl C++ and C# containers

Can someone point out a good mapping between the usual C++ STL containers such as vector, list, map, set, multimap... and the C# generic containers? I'm used to the former ones and somehow I've accustomed myself to express algorithms in terms of those containers. I'm having some hard time finding the C# equivalent to those. Thank you! ...

Asp.Net LinkButton Onclick = method( container.dataitem ), need help with syntax

I have a linkbutton that I want to call a method in the code behind. The method takes a parameter of which I need to stick in a container.dataitem. I know the container.dataitem syntax is correct because I use it in other controls. What I don't know is how to user it a parameter for a method. Upon clicking on the button, the method shoul...

Fowler Data Mapper Object Creation

I have been utilizing the Fowler patterns for domain models with a Data Mapper and have run into some confusion on how to implement the creation portion of CRUD. I can't utilize existing ORM technologies as the underlying data sources are custom systems. The area that’s troubling me is how to call the underling ORM when I need to create ...

Copy map values to vector in STL

Working my way through Effective STL at the moment. Item 5 suggests that it's usually preferable to use range member functions to their single element counterparts. I currently wish to copy all the values in a map (i.e. - I don't need the keys) to a vector. What is the cleanest way to do this? ...

How do I write an application that more or less acts as a container?

I am planning an application that must provide services that are very much like those of a JEE container to third party extension code. Basically, what this app does is find a set of work items (currently, the plan is to use Hibernate) and dispatch them to work item consumers. The work item consumers load the item details, invoke third...

Number of items stored in Bucket list

I was wondering how to get the number of items stored in a TBucketList. As far as I can see there is only the number of buckets and the bucket array available, so all I can think of is Count := 0; for I := 0 to BucketList.BucketCount - 1 do Inc (Count, BucketList.Buckets [I].Count); That does work but it seems odd to me, that I have...

Notifying container object: best practices

I have two classes: Account and Operator. Account contains a list of Operators. Now, whenever an operator (in the list) receives a message I want to notify Account object to perform some business logic as well. I think of three alternatives on how to achieve this: 1) Hold a reference within Operator to the container [Account] object an...

jQuery height() problems with Internet Explorer 6

I'm using jQuery 1.3.2. I'm having trouble getting a correct "height" in Internet Explorer 6. Height values are correct in all other browsers. I am also using wresize jQuery plugin. Each time the browser loads, I fire a method that resizes divs, iframes based upon browser dimensions. (There's a good reason for this.) The returned v...

How should unit tests set up data sources when not running in an application server?

Thank you all for your help. A number of you posted (as I should have expected) answers indicating my whole approach was wrong, or that low-level code should never have to know whether or not it is running in a container. I would tend to agree. However, I'm dealing with a complex legacy application and do not have the option of doing a...