In the MVC RC 2 docs, we find:
Expression-based helpers that render input elements generate correct name attributes when the expression contains an array or collection index. For example, the value of the name attribute rendered by Html.EditorFor(m => m.Orders[i]) for the first order in a list would be Orders[0].
Anyone care to lin...
We've got a Class called Group, it contains a collection of questions and it also contains collection of groups (i.e. we have a potential nesting of groups).
Expressed in XML this might look something like this:
<group id="Group1">
<questions>
<question id="questions11"/>
</questions>
<groups>
<group id="group12">
...
Hi,
My object looks something like this:
class
{
int a;
object b;
IList<string> c;
}
All the fields are getting populated from the database and the collection is getting lazy initialization which is desirable.
Now, my problem is that I want to send this object to the web service. But since the collection is lazily loaded...
How would you succinctly assert the equality of collections elements, specifically a Set in JUnit 4?
...
I have a MyBean annotated
@XmlRootElement
public class MyBean ...
Marshalling/Unmarshalling MyBean w/o problems, e.g.
JAXBContext jaxbCtx = JAXBContext.newInstance(MyBean.class);
Marshaller m = jaxbCtx.createMarshaller();
m.marshal(myBean, writer);
How can I use JAXB to marshall/unmarshall a Collection or List?
My attempt results ...
Hi there
I'm busy preparing for the MCTS 70-536 exam, according to the exam book (Microsoft Press - .NET Framework - Application Development Foundation Self Paced Training Kit 2nd Edition), this code sample:
ArrayList al = new ArrayList();
al.AddRange(new string[] { "Hello", "world", "this", "is", "a", "test" });
Console.WriteLine(al.B...
Hi all,
I noticed a strange behavior (for me) when sorting a list retrieved with Arrays.asList(). It seems that after Collections.sort( list ), the origin array is also sorted !
How is it possible ?
List<Rate> rates = Arrays.asList( arrayRates );
Collections.sort( rates, new RateEffectiveDateComparator() );
/* after that the rates lis...
Hi,
I'm looking for a implementation of java.util.Queue or something in the Google collection who behave like a Queue, but also ensure that each element of the queue is unique. (all further insertion will have no effect)
It's that possible, or will I have to do it by hand?
For now I'm using a Queue, with a LinkedList implementation, a...
I am currently doing this:
Set<String> listOfTopicAuthors = ....
List<String> list = Arrays.asList(
listOfTopicAuthors.toArray( new String[0] ) );
Can you beat this ?
...
Is there a standard Java (1.5+) implementation (i.e. no 3rd party) of a collection which allows me to glue several collections into one?
Here's a sketch, of how it works:
final SomeCollection x = new SomeCollection();
final ArrayList a = new ArrayList();
a.add("first");
assert(a.size() == 1);
x.embed(a); // don't know for sure, if th...
Hello boys and girls.
I'm trying to get my head around collection_selects in Rails. I can populate the dropdown from a database table, submit the selected option, and show the result. However I can't figure out how to show the selected option in the dropdown when the user chooses to edit the entry.
Here's an extract from my view code:
...
Hi there,
Is there a way to get the first item of a non indexed collection in HQL, nested in a select statement? f.e. FROM ProjectPhase p WHERE p.Statusses[0].FullFilled = 'True' When p.Statusses is an IList, this works because the list is indexed but if p.Statusses is a bag, this doesn't work (because the items in a bag aren't indexed)...
Imagine you have a set of five elements (A-E) with some numeric values of a measured property (several observations for each element):
A = {100, 110, 120, 130}
B = {110, 100, 110, 120, 90}
C = { 90, 110, 120, 100}
D = {120, 100, 120, 110, 110, 120}
E = {110, 120, 120, 110, 120}
First, I have to detect if there are significant differen...
I have two very large tables and I need to process a small resultset from these tables. However, processing is done in several functions each and function must do some joining in order to format the data in proper way.
I would definitely need to cache the initial resultset somehow so it can be reused by the functions. What I would like ...
I have the need to embed an object (A Dictionary) in an assembly. The Dictionary was created and populated within another application. I know I can serialize the dictionary to a file and then embed that file - just wanted to see if there were any preferable methods. I am also unaware if there is a significant performance issue of readin...
Sometime in VB.net i have something like:
For Each El in Collection
Write(El)
Next
But if i need the index number, i have to change it to
For I = 0 To Collection.Count() - 1
Write(I & " = " & Collection(I))
Next
Or even (worse)
I = 0
For Each El In Collection
Write(I & " = " & El)
I += 1
Next
Is there another way of ...
What is the best having when implementing Memento pattern (for Undo/Redo)
in witch collection to Keep Mementos?
Basically, I need this(c = change, u = undo, r = redo):
0
*c
-1 0
*c
-2 -1 0
*c
-3 -2 -1 0
<u
...
I dont understand why I cannot do the below - This should work??
foreach (DataRow dataRow in dataTable.Rows)
{
if (true)
{
dataRow.Delete();
}
}
...
PriorityBlockingQueue is unbounded, but I need to bound it somehow. What is the best way to achieve that?
For information, the bounded PriorityBlockingQueue will be used in a ThreadPoolExecutor.
NB: By bounded I don't want to throw Exception if that happens, I want to put the object in the queue and then cut it based on its priority va...
I just stumbled on one of Tony Morris' blog-posts about Java and a fundamental problem with the language: that of defining a bespoke equality-relation for a collection. This is something that I think is a big deal and wondered whether there was some scala solution.
The classic issue manifests itself in thinking about, say, a trade. Let...