map

C++: Determine if map contains a value for a key?

What is the best way to determine if a STL map contains a value for a given key? #include <map> using namespace std; struct Bar { int i; }; int main() { map<int, Bar> m; Bar b = {0}; Bar b1 = {1}; m[0] = b; m[1] = b1; //Bar b2 = m[2]; map<int, Bar>::iterator iter = m.find(2); Bar b3 = iter->secon...

map versus mapM behavior

I'm on the I/O chapter of Real World Haskell. Monads aren't discussed in the book for another 7 chapters. Which is to say, my understanding of I/O is, at best, incomplete. Right now I am trying to comprehend the mapM function. As I understand it, the function "executes" each element in the list which must be an "action" (IO monad). ...

Working in java image

Dear All, I will explain my question clearly. I need to zoom in/zoom out the world map. When I click on the particular country in map, control should redirected to new page with respective the country. I dont have any idea about this in java. Please explain the steps to acheive the above task. ...

How Can I Proj4 details from the Shape File's .prj file ?

Hi I am using mapdotnet services for our gis application to load the shape files and this mapdotnet service want the proj4 details and that getting from the spatialreference.org but for this proj4 details is blank. any other way to get it. Below is the .prj of the shape file- PROJCS["NAD_1983_HARN_WISCRS_EauClaire_County_Feet",GEOGCS...

Determine how many fields a Javascript object has.

I have a Javascript object that I'm trying to use as a "hashmap". The keys are always strings, so I don't think I need anything as sophisticated as what's described in this SO question. (I also don't expect the number of keys to go above about 10 so I'm not particularly concerned with lookups being O(n) vs. O(log n) etc.) The only func...

Scatter plot with indication of the density of points.

R's qplot function has a nifty alpha parameter for shading coincident points in a scatter plot darker. Here it is in action: http://www.decisionsciencenews.com/2010/07/01/maps-without-map-packages I'm wondering how to do the same in Mathematica. Here's code to grab the data from the above article and plot it, without the nifty shading...

Map with Split & Trim in Perl

How do I use map with the split function to trim the constituents: $a, $b, $c and $d; of $line? my ($a, $b, $c, $d, $e) = split(/\t/, $line); # Perl trim function to remove whitespace from the start and end of the string sub trim($) { my $string = shift; $string =~ s/^\s+//; $string =~ s/\s+$//; return $string; } ...

Map-Side Join Algorithm for MapReduce

Hi Everyone, I am trying to use the Hadoop's Map-side join using CompositeInputFormat but I get an error: "Unmatched ')'". I guess there may be a problem in the format of my input file. I have formatted the input files manually in such a way that keys are in sorted order in both the input files. Is this correct or do I have to pass the ...

Is there a Cocoa equivalent of map from C++?

I really love map in C++, it's fast and easy to program. Is there anything similar in Cocoa? I know I can mix C++ and obj-c together, but I'd rather use a more obj-c way to program :) Thanks!! ...

usual hashtable implementation compared to tree

Usually (as in C++), the hash function returns any size_t value -- thus many different hash values are possible (2^32). That is why I always thought that when people talked about them being implemented as tables, that is not really true in practice because the table would be much too big (2^32 entries). Of course my assumption was wrong...

Drupal location gmap node map not showing up on the node page.

Hi! I am using gmap and location modules to support my content type's location. I have configured those modules (Map API key, etc...) so when I edit / add new node I get pretty google map to choose/set lattitude jus by mouse pointing. I can put also address, etc.. But when I view my node map is not showing up. I can only see address fiel...

Convert a F# map to a Hashtable

I need to convert a F# map class to a System.Collections.Hashtable for use by C#. This question is not the same as the following: http://stackoverflow.com/questions/3032298/how-do-you-use-get-values-from-keys-add-items-hashtables-in-f That question asked how to return values from a hashtable. I want to build an F# map and then convert ...

How can I show different points with different markers( as image) using database on Report Builder 3 .0?

Hi, i encountered some problems on Report Builder. i created two tables. One of them includes geospatial data(points), city name and city code. other includes city code and its image(each city has own image). these tables have relationship as you see. date type of Fiels : geom : geography cityname: varchar(50) citycode : varchar(1...

map iterator in template function unrecognized by compiler

I have the following code. template<class key,class val> bool has_key(key chkey,std::map<key,val> map){ for (std::map<key,val>::iterator it = map.begin(); #line 13 referenced by gcc it!=map.end(); ++it){ if(chkey == it->first) return true; } return false; } GCC is giving me the following error. objects.hpp: In functio...

Is there any Offline Map Libraries for PHP?

Hello guys, is there any offline map libraries that can be used from PHP? I want to make an application which displays all data position of stations (with latitude and longitude) on a map. But the user doesn't want this application connect to internet, so I can't use Google Maps as a solution. Do you know any offline map libraries th...

show current location along with destination on same map for iphone

I am using the following code to display a map of destination: NSString * theAddress = [myString stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&amp;output=csv", theAddress]; NSString *locationString = [[[NS...

how to change color of pin for mapview iphone

MyAnnotation *ann1 = [[MyAnnotation alloc] init]; ann1.coordinate =region.center; [mapView addAnnotation:ann1]; right now its purple i want red ...

warning: std::binary_function<int, int, bool>::binary_function()has different visibility (default) in static library "*.a"

I define a std::map in static library .a like this ////////////////////////////////////// #import <map> class CCImage; class ImageArray{ std::map<int,CCImage*> mapCCImages; private: int imagesLength; public: ImageArray(); ~ImageArray(); int getImageLen(); bool addCCImage(int key,CCImage * texture,bool replace = true); CCImage *g...

Fastest C++ map?

Correct me I'm wrong but std::map is an ordered map, thus each time I insert a value the map uses an algorithm to sort its items internally, which takes some time. My application gets information regarding some items on a constant interval. This app keeps a map which is defined like this: ::std::map<DWORD, myItem*> At first all item...

Java: how to convert a List<?> to a Map<String,?>

I would like to find a way to take the object specific routine below and abstract it into a method that you can pass a class, list, and fieldname to get back a Map. If I could get a general pointer on the pattern used or , etc that could get me started in the right direction. Map<String,Role> mapped_roles = new HashMap<String,Role>()...