map

STL map--> sort by value?

Hi I wonder how can I implement the STL map sorting by value. For example, I have a map m map<int, int>; m[1] = 10; m[2] = 5; m[4] = 6; m[6] = 1; and then.. I'd like to sort that with the m's value. So, if I print the map, I'd like to get the result like m[6] = 1 m[2] = 5 m[4] = 6 m[1] = 10 this. How can I sort like this way? Is...

Terminology: If I remove all but one value sharing a key from a MultiMap, what have I done?

Suppose that I have a multimap (which maps multiple values to a single key), and then I decide that I need to remove all but the first/last/predicate-matching value for all keys. After this operation, I have a traditional map (which maps a single value to a single key). Is there a word that describes this operation? The best I've come...

Is there any way to limit the size of an STL Map?

I want to implement some sort of lookup table in C++ that will act as a cache. It is meant to emulate a piece of hardware I'm simulating. The keys are non-integer, so I'm guessing a hash is in order. I have no intention of inventing the wheel so I intend to use std::map for this (though suggestions for alternatives are welcome). The q...

How to insert into std::map.

In code below: map<string,vector<int>> create(ifstream& in, const vector<string>& vec) { /*holds string and line numbers into which each string appears*/ typedef map<string,vector<int>> myMap; typedef vector<string>::const_iterator const_iter; myMap result; string tmp; unsigned int lineCounter = 0; while(st...

Overlay image/map on MapView?

Okay, hope you can help med here :) I have been searching everywhere to figure this out, but haven't had any luck. I know about Annotations and how to overlay them on a map on the iPhone. But what if I have location like in the forest where there arent any roads or anything. What I am asking is, how can I overlay a custom image (map) ...

Alternative to google map api, so that I can use it on a HTTPS/SSL encrypted website.

I have a question regarding map api. I was using the the google map api in my website before. But since I have encryption the site using HTTPS/SSL support, the google map api stopped working. I checked online, and realised that google has a Premier account only that would allow me to use HTTPS supported maps api and it cost $10,000 per...

Android: Using GEO uri

Hi, I have read the doc and some tutorials to get a .kml file working launching the google maps activity. When I hosted the file in a server, this works perfectly: Intent myIntent = new Intent( android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=http://somedomain.com/file.k...

java.util.Map with HtmlDataTable

Hi, I'm developing an application on GlassFish v3 which uses Suns-RI of JavaEE6 and JSF2.0, etc. And the bad thing is, that no changes/switches away from Suns RI can be made (to use MyFaces or something like that). Now, the problem is, that I want to build HtmlDatatable by hand ( in Java code). The datatable should represent a jav...

Data Structures for hashMap, List and Set

Can any one please guide me to look in depth about the Data Structures used and how is it implemented in the List, Set and Maps of Util Collection page. In Interviews most of the questions will be on the Algorithms, but I never saw anywhere the implementation details, Can any one please share the information. ...

Having two sets of input combined on hadoop

I have a rather simple hadoop question which I'll try to present with an example say you have a list of strings and a large file and you want each mapper to process a piece of the file and one of the strings in a grep like program. how are you supposed to do that? I am under the impression that the number of mappers is a result of the ...

Map data structure in pl/sql for storing key value pair?

Is there anyway to create a map data structure in pl/sql. ...

Toggling on/off Markers in Google Maps API v3

I'm having trouble getting the setMap(null); function that everyone seems to be recommending to work. I believe it may be a problem with the way I've implemented the markers. If someone could take a look and let me know if you see something wrong I'd greatly appreciate it. LINK: http://www.dougglover.com/samples/UOITMap/v2/ ...

Drawing a path with a line in OpenLayers using JavaScript

I have seen the examples presented here of how to draw a line but the examples only show how to do it with the mouse, by clicking. What I want to do is draw the line manually using JavaScript given a list of Longitude and Latitude coordinates. The reason I cannot work on the source provided in the link above is because they are only ca...

Monotouch - caching maps for offline use

Is there a way to cache map data for offline use? we're creating a guide app that will be used in areas where there is no reception and will need to display maps in this environment is this possible? Cheers w:// ...

shortest path search in a map represented as 2d shapes

Hi, I have a small library of a few shortest path search algorithms. They were developed for simple undirected graphs (the normal representation - vertices and edges). Now I'd like to somehow apply them on a bit different scenario - where the maps are represented as 2-dimensional shapes, connected by shared edges (edges of the polygons,...

iPhone: Ovi maps

hi all, I want to use Ovi map in my iPhone application. I searched for Ovi map on google but presently it is not open.Basically I want to know following things OVi map service is from Nokia. So can i use Ovi Map in my iPhone application. If answer of 1 point is Yes, then where I found support info(code sample/classes/framework) for iP...

JPA map relation entity parentID...

Hello, could someone help me to understand how can I define an entity with JPA mapping that has a relation with it self? For example, my entity is CompanyDivision, divisionA contains divisionB, divisionC and divisionB contains divisionB1, divisionB2 divisionA divisionB divisionB1 divisionB2 d...

How can I drag a DOM object(image) (which is outside of ) into a map then create a marker there?

Hi, I just want to add some kind of markers which are listed beside map, then user can drag them in to map. I tried to use GEvent.addDomListener(domObj, "drag",functName); but it didn't works. Is there any way to do that? Thanks Dau ...

How can I copy one map into another using std::copy?

I would like to copy the content of one std::map into another. Can I use std::copy for that? Obviously, the following code won't work: int main() { typedef std::map<int,double> Map; Map m1; m1[3] = 0.3; m1[5] = 0.5; Map m2; m2[1] = 0.1; std::copy(m1.begin(), m1.end(), m2.begin()); return 0; } This won't work because co...

Why can't I pass const map structure to a function in c++?

I tried to pass const with vector it works: Ex: void damn(const vector <bool> &bb) { for (int i=0; i<bb.size(); i++) cout<<bb[i]<<endl; } But when trying with map, it does not: void pas(const map <string, float> &mm) { cout<<mm["a"]; cout<<mm["b"]; } I wonder why it doesn't. ...