That is, I'd like to have a tuple of values.
The use case on my mind:
Dictionary<Pair<string, int>, object>
or
Dictionary<Triple<string, int, int>, object>
Are there built-in types like Pair or Triple? Or what's the best way of implementing it?
Update There are some general-purpose tuples implementations described in…
Ok...here's a softball question...
I just need to be able to insert a key/value pair into an object at a specific position. I'm currently working with a Hashtable which, of course, doesn't allow for this functionality. What would be the best approach?
UPDATE: Also, I do need the ability to lookup by the key.
For example...oversimplified and…
I work at a very small company so certificate costs need to be absolutely minimal. However for some applications we do Need to have our customers get that warm fuzzy not-using-a-self-signed certificate feeling.
Since creating a "certificate authority" with makecert really just means creating a public/private key pair, it seems pretty clear…
Hi,
I'm trying order pairs of integers ascendantly where a pair is considered less than another pair if both its entries are strictly less than those of the other pair, and larger than the other pair if both its entries are strictly larger than those of the other pair. All other cases are considered incomparable.
They way I want to solve…
Here is the story so far:
A client hired us to do an iPhone app for them. This client had never done an iPhone app before and as part of the arrangement we handled all aspects for them, including app store submission, and we handle some level of future development (new features, bug/security fixes, etc.)
We created a Distribution…
I realize there are subtly different semantics for some of these, because of ADL.
In general, though: Which one should I prefer (if any), and why?
(Or does it depend on the situation (e.g. inline header vs. implementation?)
Also: should I prefer ::std:: over std::?
using namespace std;
pair<string::const_iterator,…
Hi all,
I am wondering if there exists in R a package/function to perform the: "Post Hoc Pair-Wise Comparisons for the Chi-Square Test of Homogeneity of Proportions" (or an equivalent of it) Which is described here:
http://epm.sagepub.com/cgi/content/abstract/53/4/951
My situation is of just making a chi test, on a 2…
I am need to send a return specific value from a mock object based on a specific key value.
concreate class:
map.put("xpath", "PRICE");
search(map);
Test case:
IOurXMLDocument mock = mock(IOurXMLDocument.class);
when(mock.search(.....need help here).thenReturn("$100.00");
how do I mock this method call for this…
Hi,
Given a pair of floats for latitude and longitude, and a MapView, how do I get the MapView to drop a pin in the location and "zoom" the screen to display the location?
I've read through some of the SO posts and they all seem to be about specific aspects of this, but I haven't been able to "put them together" in…
Hi,
I have defined my Enums like this.
public enum UserType {
RESELLER("Reseller"),
SERVICE_MANAGER("Manager"),
HOST("Host");
private String name;
private UserType(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
What should be…
DISCLAIMER:
THIS QUESTION WAS NOT MENT TO BE ARGUMENTATIVE!!!!!!!
What is fastest and less memory draining way of searching a key-value pair? I will be storing items in a key-value like relation and I need to access them quickly. Should I use a SQLite database? A Map? A Hashtable? A HashMap? Please give some…
I have written the following code to check if a tree is a Binary search tree. Please help me check the code:
Pair p{
boolean isTrue;
int min;
int max;
}
public boo lean isBst(BNode v){
return isBST1(v).isTrue;
}
public Pair isBST1(BNode v){
if(v==null)
return new Pair(true,…
I work at a very small company so certificate costs need to be absolutely minimal. However for some applications we do Need to have our customers get that warm fuzzy not-using-a-self-signed certificate feeling.
Since creating a "certificate authority" with makecert really just means creating a…
In SICP exercise 2.26, this Scheme code is given:
(define x (list 1 2 3))
(define y (list 4 5 6))
Then this cons call is given:
(cons x y)
I expected a pair of lists would result, ((1 2 3) (4 5 6)) but the interpreter gives,
((1 2 3) 4 5 6)
...a list with 4 elements, the first being a…
Hello, everyone!
I have an understanding problem of how the following code works:
XMLInputFactory xif = XMLInputFactory.newFactory();
XMLOutputFactory xof = XMLOutputFactory.newFactory();
XMLEventReader reader = xif.createXMLEventReader(/* ... */);
XMLEventWriter writer =…
How can I write a function that takes an array of integers and returns true if their exists a pair of numbers whose product is odd?
What are the properties of odd integers? And of course, how do you write this function in Java? Also, maybe a short explanation of how you…
I'm working on a project that we want to use Unicode and could end up in countries like Japan, etc... We want to use std::string for the underlying type that holds string data in the data layer (see Qt, MSVC, and /Zc:wchar_t- == I want to blow up the world as to why). …
I have a codeigniter shopping cart going and its "cart" array is the following:
Array (
[a87ff679a2f3e71d9181a67b7542122c] => Array
(
[rowid] => a87ff679a2f3e71d9181a67b7542122c
[id] => 4
[qty] => 1
[price] => 12.95
…
Hello,
I have several huge sorted enumerable sequences that I want to merge. Theses lists are manipulated as IEnumerable but are already sorted. Since input lists are sorted, it should be possible to merge them in one trip, without re-sorting anything.
I would like to…
Hi all,
Im trying to create a map, where the key is an int, and the value is an array
int red[3] = {1,0,0};
int green[3] = {0,1,0};
int blue[3] = {0,0,1};
std::map<int, int[3]> colours;
…
We are using Antlr StringTemplates to give control over how a Entity's Name is output.
The basic Stringtemplate is
$FirstName$ $Initial$ $LastName$,
$Suffix$, $Degree$
I want to add some…
I have some code that returns unique elements in my dictionary, but I would also like to return the count of the duplicate elements. Basically change dictionary[key, uniqueelement] to…
The idea that the standard Monad class is flawed and that it should actually extend Functor or Pointed is floating around.
I'm not necessarily claiming that it is the right thing to…