Questions tagged [contract]
424 questions
1
vote
1 answer
Comparison Method violates its general contract. Simple comparison
I'm doing a card game in swing (java)
The user has to wait his turn, take a card, and press confirm. When it's not his turn, he can't take any card.
It starts this way:
this.cardTaken = false;
board.canTakeCards(!cardTaken);
Then in board class it…

auron344
- 81
- 1
- 7
1
vote
1 answer
Comparison method violates its general contract, with long comparsion
Collections.sort(cells, new Comparator() {
@Override
public int compare(MyCell o1, MyCell o2) {
if (o1.getX() <= o2.getX() && o1.getY() <= o2.getY()) {
return -1;
} else {
…

Sarajog
- 164
- 16
1
vote
3 answers
Should I avoid message inheritance in WCF?
Generally, I try and avoid using inheritance in WCF contracts, preferring composition.
But in the following situation...
I have a service operation that can result in one of two things: ResultA and ResultB.
There is a boolean/enum in the response…

jonhy
- 66
- 3
1
vote
2 answers
streaming a file while hes being written in WCF
I have a Server Application who EXEC another app, that second app builds a log file,
and I want the server to send it to a client via WCF.
I want the client to read the log while the EXEC app update it.
I've used an operation contract that returns…

IsraelKo
- 106
- 1
- 5
1
vote
2 answers
WCF contract mismatch case that is working
I have a WCF service hosted on 2 servers. There was a function called GetData(param1).
I changed this function to accept 2 parameters i.e. GetData(param1,param2).
I updated the service on server1 and I updated the client code.
A weird thing is…

mustafabar
- 2,317
- 6
- 31
- 47
1
vote
4 answers
Do preconditions usually overlap with invariants?
I'm having trouble differentiating the two. If they do not usually overlap, how are they different? What is an example of something that would be a precondition but not an invariant?

dtgee
- 1,272
- 2
- 15
- 30
1
vote
1 answer
How do I convert "generic" expressions into asserted predicate expressions? (Clojure)
I am attempting to write a macro that converts "generic" expressions into expressions evaluated for a particular given value.
Let us say that I have a vector of unevaluated expressions of the form,
'[(map? %)
(-> % :value…

Stephen Cagle
- 14,124
- 16
- 55
- 86
1
vote
2 answers
Django, unit test for SOA style sites without data contract
Let's say I have 2 django projects within the company, A and B, B consumes data from A via a restful API, and it doesn't have WADLs
Originally my unit test (more like a functional test) consumes data directly from A, but it poses a lot of issues to…

James Lin
- 25,028
- 36
- 133
- 233
1
vote
1 answer
Contract assembly included in executable is not found
I'm using MEF to develop a plugin system. The basic plugins are merged (using ilmerge) with the executable to get one single executable. These plugins are loaded using the AssemblyCatalog. But it should be possible to add plugins using the…

Propantriol
- 161
- 4
1
vote
1 answer
WCF service starts up takes 10 seconds with a big service contract having 1000 methods
I'm using a named-pipe WCF service, which has about 1000 methods (yes, I know it's not a good practice, but it's life...).
The problem I got is that when starting up the WCF service, it costs about 10 seconds on constructor of ServiceHost class. By…

Alex
- 53
- 5
1
vote
2 answers
Contract for hosted software
I've finally found a client for my hosted software - the first time I've ever sold software. I want both parties to sign a contract specifying things like expected uptime, payment schedules, etc., so that no one feels like they've been cheated, but…

benjy
- 4,664
- 7
- 38
- 43
1
vote
1 answer
ServiceStack custom contract resolver
Is it possible to provide somekind of custom contract resolver to the build-in JsonSerializer?
The response data is formatted as this:
{
"name":"Rob Angelier"
}
The property i would like to set is: Name
The question is: How can i deserialize from…

Rob Angelier
- 2,335
- 16
- 29
0
votes
3 answers
Determining if a Java Iterable is ordered by contract
I am looking for a way to determine if a Collection (or maybe even any Iterable) is guaranteed to be ordered by its class contract.
I already know the Guava method : Ordering.natural().isOrdered(myCollection)
But this method is not relevant to my…
0
votes
2 answers
Struct/Class to Interface substitution contract broken?
public interface IVector {
void Add(ref IVector addend);
}
public struct Vector3f : IVector {
public void Add(ref Vector3f addend);
}
Compiler answer:
"Vector3f does not implement interface member…

Alexander Shukaev
- 16,674
- 8
- 70
- 85
0
votes
1 answer
Injecting an unrelated contract into the WSDL created by WCF's MEX provider
I am implementing a WCF service (Contract A) that will eventually make calls to a standalone service (Contract B) hosted by the client. At design-time when the client queries my service's WSDL to build its proxy, I'd like to include the WSDL for…

Mike
- 7,500
- 8
- 44
- 62